-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
standard-chinese-characters
tool.
- Loading branch information
1 parent
3aa17c2
commit 2005967
Showing
13 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "@wcj/tools-react-standard-chinese-characters", | ||
"version": "1.7.0", | ||
"main": "./cjs/index.js", | ||
"module": "./esm/index.js", | ||
"scripts": { | ||
"build": "tsbb build", | ||
"watch": "tsbb watch" | ||
}, | ||
"keywords": [], | ||
"files": [ | ||
"cjs", | ||
"esm", | ||
"src" | ||
], | ||
"author": "Kenny Wong <wowohoo@qq.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@wcj/tools-react-components": "1.7.0", | ||
"togscc": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.14.0", | ||
"react-dom": ">=16.14.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { memo } from 'react'; | ||
|
||
export const HansIcon = memo<React.PropsWithChildren<any>>(({ children }) => { | ||
return ( | ||
<svg viewBox="0 0 46 46"> | ||
<g fill="none" fillRule="evenodd"> | ||
<line x1=".5" x2="45.5" y1="23" y2="23" stroke="var(--color-border-muted)" strokeLinecap="square" /> | ||
<line | ||
x1="1" | ||
x2="45" | ||
y1="23.5" | ||
y2="23.5" | ||
stroke="var(--color-border-muted)" | ||
strokeLinecap="square" | ||
transform="rotate(90 23 23.5)" | ||
/> | ||
<line | ||
x1="-7.712" | ||
x2="53.099" | ||
y1="22.883" | ||
y2="22.883" | ||
stroke="var(--color-border-muted)" | ||
strokeDasharray="2 4" | ||
strokeLinecap="square" | ||
transform="rotate(45 22.705 23.311)" | ||
/> | ||
<line | ||
x1="-7.88" | ||
x2="52.922" | ||
y1="22.835" | ||
y2="21.774" | ||
stroke="var(--color-border-muted)" | ||
strokeDasharray="2 4" | ||
strokeLinecap="square" | ||
transform="rotate(136 22.62 22.749)" | ||
/> | ||
<rect width="45" height="45" x=".5" y=".5" stroke="var(--color-border-muted)" rx="3" /> | ||
<text | ||
fontFamily="-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif" | ||
fontSize="23" | ||
letterSpacing="-0.828571429" | ||
fill="currentColor" | ||
> | ||
<tspan x="11.9142857" y="31"> | ||
{children}{' '} | ||
</tspan> | ||
</text> | ||
</g> | ||
</svg> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'nzh/cn' { | ||
export * from 'nzh'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { memo } from 'react'; | ||
import { Wrapper, StyledLayout, Spacing } from '@wcj/tools-react-components'; | ||
import styled from 'styled-components'; | ||
import { useTranslation } from 'react-i18next'; | ||
import characters from 'togscc'; | ||
import { HansIcon } from './Icon'; | ||
|
||
const HansWarpper = styled.div` | ||
width: 42px; | ||
height: 42px; | ||
border-radius: 2px; | ||
`; | ||
|
||
const HansInner = styled.div` | ||
height: 100%; | ||
width: 100%; | ||
`; | ||
|
||
const Hans = memo<React.PropsWithChildren<any>>(({ children }) => { | ||
return ( | ||
<HansWarpper> | ||
<HansInner>{children}</HansInner> | ||
</HansWarpper> | ||
); | ||
}); | ||
|
||
export default function AmountInRMB() { | ||
const { t } = useTranslation(['standard-chinese-characters', 'common']); | ||
|
||
return ( | ||
<Wrapper> | ||
<StyledLayout overflow="initial" title={t('Table of General Standard Chinese Characters', {})}> | ||
<Spacing style={{ paddingTop: 10, flexWrap: 'wrap', flexDirection: 'row' }}> | ||
{Object.keys(characters).map((keyname, idx) => { | ||
return ( | ||
<Hans key={idx}> | ||
<HansIcon>{keyname}</HansIcon> | ||
</Hans> | ||
); | ||
})} | ||
</Spacing> | ||
</StyledLayout> | ||
</Wrapper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig", | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "cjs", | ||
"noEmit": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Table of General Standard Chinese Characters": "通用规范汉字表" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters