Skip to content

Commit

Permalink
Remove react-icons in favor of embedding svg directly
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegWock committed Feb 23, 2023
1 parent 980d648 commit 71337da
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
36 changes: 18 additions & 18 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"react-local-toast.cjs.development.js": {
"bundled": 19762,
"minified": 9871,
"gzipped": 3037
"bundled": 23250,
"minified": 12659,
"gzipped": 3811
},
"react-local-toast.cjs.production.js": {
"bundled": 19762,
"minified": 9871,
"gzipped": 3037
"bundled": 23250,
"minified": 12659,
"gzipped": 3811
},
"react-local-toast.esm.js": {
"bundled": 18547,
"minified": 8879,
"gzipped": 2886,
"bundled": 21702,
"minified": 11366,
"gzipped": 3645,
"treeshaked": {
"rollup": {
"code": 262,
"import_statements": 262
"code": 169,
"import_statements": 169
},
"webpack": {
"code": 8763
"code": 11045
}
}
},
"react-local-toast.umd.development.js": {
"bundled": 110082,
"minified": 34483,
"gzipped": 11267
"bundled": 108949,
"minified": 33947,
"gzipped": 10979
},
"react-local-toast.umd.production.js": {
"bundled": 59554,
"minified": 21489,
"gzipped": 7176
"bundled": 58421,
"minified": 20966,
"gzipped": 6878
},
"internals.js": {
"bundled": 10559,
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-local-toast",
"version": "1.1.4",
"version": "1.2.0",
"description": "Local toast helps you to provide feedback related to particular components on page",
"main": "dist/index.js",
"module": "dist/react-local-toast.esm.js",
Expand Down Expand Up @@ -52,7 +52,6 @@
"@radix-ui/react-compose-refs": "^1.0.0",
"@radix-ui/react-slot": "^0.1.2",
"clsx": "^1.1.1",
"react-icons": "^4.4.0",
"react-transition-group": "^4.4.2",
"tslib": "^2.3.0",
"uuid": "^8.3.2"
Expand Down Expand Up @@ -97,4 +96,4 @@
"shx": "0.3.3",
"typescript": "4.3.5"
}
}
}
5 changes: 1 addition & 4 deletions src/default-implementation.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React from 'react';
import clsx from 'clsx';
import { IoIosCheckmarkCircle, IoIosInformationCircle } from 'react-icons/io';
import { IoCloseCircleSharp } from 'react-icons/io5';
import { RiErrorWarningFill } from 'react-icons/ri';
import { AiOutlineLoading } from 'react-icons/ai';
import { createCustomLocalToast } from './factory';
import { DefaultToastData, ToastPlacement, ToastComponentProps } from './types';
import { DEFAULT_PLACEMENT } from './const';
import { createHocFromHook } from './hoc';
import { AiOutlineLoading, IoCloseCircleSharp, IoIosCheckmarkCircle, IoIosInformationCircle, RiErrorWarningFill } from './icons';

const animations = {
top: 'rltTop',
Expand Down
21 changes: 21 additions & 0 deletions src/icons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { ComponentProps, forwardRef } from "react";

export const IoIosCheckmarkCircle = forwardRef<SVGSVGElement, ComponentProps<"svg">>((props, ref) => {
return (<svg stroke="currentColor" data-test="yes" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" ref={ref} {...props}><path d="M256 48C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48zm106.5 150.5L228.8 332.8h-.1c-1.7 1.7-6.3 5.5-11.6 5.5-3.8 0-8.1-2.1-11.7-5.7l-56-56c-1.6-1.6-1.6-4.1 0-5.7l17.8-17.8c.8-.8 1.8-1.2 2.8-1.2 1 0 2 .4 2.8 1.2l44.4 44.4 122-122.9c.8-.8 1.8-1.2 2.8-1.2 1.1 0 2.1.4 2.8 1.2l17.5 18.1c1.8 1.7 1.8 4.2.2 5.8z"></path></svg>);
});

export const IoIosInformationCircle = forwardRef<SVGSVGElement, ComponentProps<"svg">>((props, ref) => {
return (<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" ref={ref} {...props}><path d="M256 48C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48zm19 304h-38.2V207.9H275V352zm-19.1-159.8c-11.3 0-20.5-8.6-20.5-20s9.3-19.9 20.5-19.9c11.4 0 20.7 8.5 20.7 19.9s-9.3 20-20.7 20z"></path></svg>);
});

export const IoCloseCircleSharp = forwardRef<SVGSVGElement, ComponentProps<"svg">>((props, ref) => {
return (<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" ref={ref} {...props}><path d="M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z"></path></svg>);
});

export const RiErrorWarningFill = forwardRef<SVGSVGElement, ComponentProps<"svg">>((props, ref) => {
return (<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" ref={ref} {...props}><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-7v2h2v-2h-2zm0-8v6h2V7h-2z"></path></g></svg>);
});

export const AiOutlineLoading = forwardRef<SVGSVGElement, ComponentProps<"svg">>((props, ref) => {
return (<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" ref={ref} {...props}><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg>);
});
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5287,11 +5287,6 @@ randomfill@^1.0.3:
randombytes "^2.0.5"
safe-buffer "^5.1.0"

react-icons@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.4.0.tgz#a13a8a20c254854e1ec9aecef28a95cdf24ef703"
integrity sha512-fSbvHeVYo/B5/L4VhB7sBA1i2tS8MkT0Hb9t2H1AVPkwGfVHLJCqyr2Py9dKMxsyM63Eng1GkdZfbWj+Fmv8Rg==

"react-is@^16.12.0 || ^17.0.0 || ^18.0.0":
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
Expand Down

0 comments on commit 71337da

Please sign in to comment.