Skip to content

Commit

Permalink
refactor: importing react-icons and UA flag in more efficient way
Browse files Browse the repository at this point in the history
  • Loading branch information
Acorn221 committed Dec 13, 2023
1 parent 3a255cc commit 4231ac2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.12.0",
"svg-country-flags": "^1.2.10",
"tailwindcss": "3.2.4",
"uuid": "^9.0.1",
"webextension-polyfill": "^0.10.0"
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/popup/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { GenIcon } from 'react-icons';

// all imported from react-icons

export function MdHeartBroken(props) { // @ts-ignore
return GenIcon({ tag: 'svg', attr: { viewBox: '0 0 24 24' }, child: [{ tag: 'path', attr: { fill: 'none', d: 'M0 0h24v24H0z' } }, { tag: 'path', attr: { d: 'M16.5 3c-.96 0-1.9.25-2.73.69L12 9h3l-3 10 1-9h-3l1.54-5.39C10.47 3.61 9.01 3 7.5 3 4.42 3 2 5.42 2 8.5c0 4.13 4.16 7.18 10 12.5 5.47-4.94 10-8.26 10-12.5C22 5.42 19.58 3 16.5 3z' } }] })(props);
}

export function AiOutlineSetting(props) { // @ts-ignore
return GenIcon({ tag: 'svg', attr: { viewBox: '0 0 1024 1024' }, child: [{ tag: 'path', attr: { d: 'M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z' } }] })(props);
}

export function AiOutlineInfoCircle(props) { // @ts-ignore
return GenIcon({ tag: 'svg', attr: { viewBox: '0 0 1024 1024' }, child: [{ tag: 'path', attr: { d: 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' } }, { tag: 'path', attr: { d: 'M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z' } }] })(props);
}

export function DiGoogleAnalytics(props) { // @ts-ignore
return GenIcon({ tag: 'svg', attr: { version: '1.1', viewBox: '0 0 32 32' }, child: [{ tag: 'path', attr: { d: 'M27.028 25.367c0 1.071-0.876 1.947-1.947 1.947h-18.163c-1.071 0-1.947-0.876-1.947-1.947v-18.163c0-1.071 0.876-1.947 1.947-1.947h18.163c1.071 0 1.947 0.876 1.947 1.947v18.163zM27.028 12.187l-1.992-1.342c0.040-0.172 0.064-0.351 0.064-0.536 0-1.294-1.049-2.344-2.344-2.344s-2.344 1.049-2.344 2.344c0 0.509 0.164 0.979 0.44 1.364l-4.307 6.586c-0.175-0.042-0.358-0.067-0.546-0.067-0.577 0-1.104 0.209-1.513 0.555l-2.883-1.659c0.015-0.106 0.025-0.213 0.025-0.323 0-1.294-1.049-2.344-2.344-2.344s-2.344 1.049-2.344 2.344c0 0.321 0.065 0.627 0.182 0.906l-2.153 1.997v2.125l3.198-2.967c0.332 0.18 0.712 0.282 1.116 0.282 0.62 0 1.182-0.242 1.601-0.636l2.813 1.619c-0.028 0.144-0.043 0.292-0.043 0.444 0 1.294 1.049 2.343 2.344 2.343s2.344-1.049 2.344-2.343c0-0.539-0.184-1.034-0.49-1.43l4.277-6.54c0.2 0.055 0.409 0.087 0.626 0.087 0.543 0 1.041-0.186 1.439-0.496l2.833 1.909v-1.878z' } }] })(props);
}
12 changes: 8 additions & 4 deletions src/popup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
import React, { useState, useEffect } from 'react';
import ukraineFlag from 'svg-country-flags/svg/ua.svg';
import '@/popup/style.css';
import Switch from '@mui/material/Switch';
import { AiOutlineSetting, AiOutlineInfoCircle } from 'react-icons/ai';
import { DiGoogleAnalytics } from 'react-icons/di';
import { useStorage } from '@plasmohq/storage/hook';
import browser from 'webextension-polyfill';
import { MdHeartBroken } from 'react-icons/md';
// import { MdHeartBroken } from 'react-icons/md';
import { sendToBackground } from '@plasmohq/messaging';
import ukraineFlag from './ua.svg';
import {
debug,
defaultSettings, links, text,
} from '@/misc/config';
import logo from '~assets/LighterFuel512.png';
import {
MdHeartBroken,
AiOutlineInfoCircle,
AiOutlineSetting,
DiGoogleAnalytics,
} from './icons';

import { openTab } from '@/misc/utils';
import { AnalyticsEvent } from '@/misc/GA';
Expand Down
4 changes: 4 additions & 0 deletions src/popup/ua.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4231ac2

Please sign in to comment.