Skip to content

Commit

Permalink
website: fix type error (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 22, 2022
1 parent 2b54cca commit 7aaeb99
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 145 deletions.
83 changes: 46 additions & 37 deletions packages/html-formatter/src/index.tsx

Large diffs are not rendered by default.

205 changes: 113 additions & 92 deletions packages/js-beautifier/src/index.tsx

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/simplified-traditional-chinese/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function SimplifiedTraditionalChinese() {
return (
<Wrapper>
<StyledLayout
title={t('Traditional Chinese')}
title={t<string>('Traditional Chinese')}
extra={
<Fragment>
{traditional && <CopyButton value={traditional} />}
Expand All @@ -54,7 +54,7 @@ export default function SimplifiedTraditionalChinese() {
setType('traditional');
}}
>
{t('Sample', { ns: 'common' })}
{t<string>('Sample', { ns: 'common' })}
</Button>
</Fragment>
}
Expand All @@ -71,7 +71,7 @@ export default function SimplifiedTraditionalChinese() {
/>
</StyledLayout>
<StyledLayout
title={t('Simplified Chinese')}
title={t<string>('Simplified Chinese')}
extra={
<Fragment>
{simplified && <CopyButton value={simplified} />}
Expand All @@ -80,7 +80,7 @@ export default function SimplifiedTraditionalChinese() {
setSimplified(sample.simplified);
}}
>
{t('Sample', { ns: 'common' })}
{t<string>('Sample', { ns: 'common' })}
</Button>
</Fragment>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/standard-chinese-characters/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function StandardChineseCharacters() {

return (
<Wrapper>
<StyledLayout overflow="initial" title={t('Table of General Standard Chinese Characters', {})}>
<StyledLayout overflow="initial" title={t<string>('Table of General Standard Chinese Characters', {})}>
<Spacing style={{ flexWrap: 'wrap', flexDirection: 'row', gap: '40px 61px', paddingBottom: 120 }}>
{Object.keys(characters).map((keyname, idx) => {
return (
Expand Down
14 changes: 8 additions & 6 deletions packages/svg-optimizer/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,14 @@ export default function SVGOptimizer() {
checked={!!options.pretty}
onChange={({ target }) => setOptions({ ...options, pretty: target.checked })}
>
Prettify markup <Info>{t('Prettify markup')}</Info>
Prettify markup <Info>{t<string>('Prettify markup')}</Info>
</Checkbox>
<Checkbox
checked={!!options.multipass}
onChange={({ target }) => setOptions({ ...options, multipass: target.checked })}
>
{t('multipass')}{' '}
<Info>{t('Pass over SVGs multiple times to ensure all optimizations are applied')}</Info>
{t<string>('multipass')}{' '}
<Info>{t<string>('Pass over SVGs multiple times to ensure all optimizations are applied')}</Info>
</Checkbox>
<Checkbox
type="range"
Expand All @@ -396,9 +396,11 @@ export default function SVGOptimizer() {
value={options.floatPrecision}
onChange={({ target }) => setOptions({ ...options, floatPrecision: Number(target.value) })}
>
{options.floatPrecision} {t('Precision')}{' '}
{options.floatPrecision} {t<string>('Precision')}{' '}
<Info>
{t('Precision of floating point numbers. Will be passed to each plugin that suppors this param.')}
{t<string>(
'Precision of floating point numbers. Will be passed to each plugin that suppors this param.',
)}
</Info>
</Checkbox>
{opts.map((item, key) => {
Expand All @@ -408,7 +410,7 @@ export default function SVGOptimizer() {
checked={includesPlugin(item.plugin, options.plugins)}
onChange={({ target }) => setOptions(settingPlugin(item.plugin, target.checked))}
>
{t(item.label)} <Info>{t(item.content)}</Info>
{t<string>(item.label)} <Info>{t<string>(item.content)}</Info>
</Checkbox>
);
})}
Expand Down
4 changes: 2 additions & 2 deletions website/src/app/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function HomePage() {
const thirdParty = menus.filter((item) => /^https?:/i.test(item.href || ''));
return (
<Warpper>
<Title>{t('tools')}</Title>
<Title>{t<string>('tools')}</Title>
<MenuItem>
{tools.map((item, key) => {
return (
Expand All @@ -56,7 +56,7 @@ export default function HomePage() {
);
})}
</MenuItem>
<Title>{t('ThirdPartyTools')}</Title>
<Title>{t<string>('ThirdPartyTools')}</Title>
<MenuItem>
{thirdParty.map((item, key) => {
return (
Expand Down
3 changes: 1 addition & 2 deletions website/src/app/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const Article = styled.article`
export default function Layout() {
const menus = useMenus();
const { t } = useTranslation();
// @ts-ignore
const version = VERSION;
return (
<Fragment>
Expand All @@ -67,7 +66,7 @@ export default function Layout() {
<Link to="/">
<LogoIcon width={21} />
<span>
{t('title')}
{t<string>('title')}
<Sup>{version}</Sup>
</span>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion website/src/app/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ const Warpper = styled.div`

export const Loading = () => {
const { t } = useTranslation();
return <Warpper>{t('loading')}</Warpper>;
return <Warpper>{t<string>('loading')}</Warpper>;
};

0 comments on commit 7aaeb99

Please sign in to comment.