Skip to content

Commit

Permalink
💄 style(giscus): update giscus style
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Jul 6, 2023
1 parent b30582f commit de6f8eb
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 93 deletions.
142 changes: 71 additions & 71 deletions javascript/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/pages/Header/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Actions = memo<ActionsProps>(() => {
<ActionIcon icon={Settings} onClick={() => setIsSettingOpen(true)} title={t('setting')} />
</Space.Compact>
<Setting onCancel={() => setIsSettingOpen(false)} open={isSettingOpen} />
<Giscus onCancel={() => setIsModalOpen(false)} open={isModalOpen} themeMode={themeMode} />
<Giscus onCancel={() => setIsModalOpen(false)} open={isModalOpen} />
</>
);
});
Expand Down
25 changes: 4 additions & 21 deletions src/slots/Giscus/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import GiscusComponent from '@giscus/react';
import { ActionIcon } from '@lobehub/ui';
import { ActionIcon, Giscus as G } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { Github } from 'lucide-react';
import { memo } from 'react';
Expand All @@ -9,22 +8,11 @@ import { homepage, name } from '@/../package.json';
import { Modal, type ModalProps } from '@/components';
import { useAppStore } from '@/store';

const formatLang = (lang: string) => {
if (['zh_CN', 'zh_TW'].includes(lang)) {
return lang.replace('_', '-');
} else if (lang === 'zh_HK') {
return 'zh-TW';
} else {
return lang.split('_')[0];
}
};

interface GiscusProps {
onCancel?: ModalProps['onCancel'];
open?: ModalProps['open'];
themeMode: 'light' | 'dark';
}
const Giscus = memo<GiscusProps>(({ themeMode, open, onCancel }) => {
const Giscus = memo<GiscusProps>(({ open, onCancel }) => {
const setting = useAppStore((st) => st.setting, isEqual);
const { t } = useTranslation();
return (
Expand All @@ -40,18 +28,13 @@ const Giscus = memo<GiscusProps>(({ themeMode, open, onCancel }) => {
</>
}
>
<GiscusComponent
emitMetadata="0"
id="giscus"
inputPosition="top"
lang={formatLang(setting.i18n)}
loading="lazy"
<G
lang={setting.i18n}
mapping="number"
reactionsEnabled="1"
repo="canisminor1990/sd-webui-kitchen-theme"
repoId="R_kgDOJCPcNg"
term="53"
theme={themeMode === 'dark' ? 'transparent_dark' : 'light'}
/>
</Modal>
);
Expand Down

0 comments on commit de6f8eb

Please sign in to comment.