Skip to content

Commit

Permalink
feat(Phonetic): 添加音标显示 fixed:#10
Browse files Browse the repository at this point in the history
  • Loading branch information
RealKai42 committed Feb 2, 2021
1 parent b1d3e27 commit d4b7cfe
Show file tree
Hide file tree
Showing 25 changed files with 3,435 additions and 50,317 deletions.
2,627 changes: 0 additions & 2,627 deletions public/dicts/CET4.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/CET4_N.json

Large diffs are not rendered by default.

2,380 changes: 0 additions & 2,380 deletions public/dicts/CET6.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/CET6_N.json

Large diffs are not rendered by default.

3,072 changes: 0 additions & 3,072 deletions public/dicts/GMAT.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/GMAT_N.json

Large diffs are not rendered by default.

6,525 changes: 0 additions & 6,525 deletions public/dicts/GRE.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/GRE_N.json

Large diffs are not rendered by default.

3,589 changes: 0 additions & 3,589 deletions public/dicts/IELTS.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/IELTS_N.json

Large diffs are not rendered by default.

3,736 changes: 0 additions & 3,736 deletions public/dicts/KaoYan.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/KaoYan_N.json

Large diffs are not rendered by default.

4,217 changes: 0 additions & 4,217 deletions public/dicts/Level4.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/Level4_N.json

Large diffs are not rendered by default.

12,789 changes: 0 additions & 12,789 deletions public/dicts/Level8.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/Level8_N.json

Large diffs are not rendered by default.

4,476 changes: 0 additions & 4,476 deletions public/dicts/SAT.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/SAT_N.json

Large diffs are not rendered by default.

4,282 changes: 0 additions & 4,282 deletions public/dicts/TOEFL.json

This file was deleted.

1 change: 1 addition & 0 deletions public/dicts/TOEFL_N.json

Large diffs are not rendered by default.

6,003 changes: 3,390 additions & 2,613 deletions src/assets/CET4_N.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/components/Phonetic/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'

export type PhoneticProps = {
usphone: string
ukphone: string
}

const Phonetic: React.FC<PhoneticProps> = ({ usphone, ukphone }) => {
return (
<div className="text-sm font-normal text-gray-600 text-center space-x-5">
{usphone.length > 1 && <span>{`US: [${usphone}]`}</span>}
{ukphone.length > 1 && <span>{`UK:[${ukphone}]`}</span>}
</div>
)
}

export default Phonetic
2 changes: 1 addition & 1 deletion src/components/Translation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

const Translation: React.FC<TranslationProps> = ({ trans }) => {
return <div className="pt-2 pb-8 text-xl font-normal text-center">{trans}</div>
return <div className="pt-1 pb-3 text-xl font-normal text-center">{trans}</div>
}

Translation.propTypes = {}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Word/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Word: React.FC<WordProps> = ({ word = 'defaultWord', onFinish, isStart, wo
}, [inputWord, word])

return (
<div className="py-4">
<div className="pt-4 pb-1">
{word.split('').map((t, index) => {
return (
<Letter
Expand Down
25 changes: 16 additions & 9 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Translation from 'components/Translation'
import Speed from 'components/Speed'
import Modals from 'components/Modals'
import Loading from 'components/Loading'
import Phonetic from 'components/Phonetic'
import { isLegal } from 'utils/utils'
import { useHotkeys } from 'react-hotkeys-hook'
import { useModals } from 'utils/hooks'
Expand All @@ -19,16 +20,16 @@ import cet4 from 'assets/CET4_N.json'

const dicts: any = {
cet4: ['CET-4', ''],
cet6: ['CET-6', './dicts/CET6.json'],
gmat: ['GMAT', './dicts/GMAT.json'],
gre: ['GRE', './dicts/GRE.json'],
ielts: ['IELTS', './dicts/IELTS.json'],
kaoyan: ['考研', './dicts/KaoYan.json'],
level4: ['专四', './dicts/Level4.json'],
level8: ['专八', './dicts/Level8.json'],
cet6: ['CET-6', './dicts/CET6_N.json'],
gmat: ['GMAT', './dicts/GMAT_N.json'],
gre: ['GRE', './dicts/GRE_N.json'],
ielts: ['IELTS', './dicts/IELTS_N.json'],
kaoyan: ['考研', './dicts/KaoYan_N.json'],
level4: ['专四', './dicts/Level4_N.json'],
level8: ['专八', './dicts/Level8_N.json'],
sat: ['SAT', './dicts/SAT_N.json'],
toefl: ['TOEFL', './dicts/TOEFL_N.json'],
coder: ['Coder Dict', './dicts/it-words.json'],
sat: ['SAT', './dicts/SAT.json'],
toefl: ['TOEFL', './dicts/TOEFL.json'],
jsArray: ['js-array', './dicts/js-array.json'],
jsDate: ['js-date', './dicts/js-date.json'],
jsGlobal: ['js-global', './dicts/js-global.json'],
Expand All @@ -43,6 +44,8 @@ const dicts: any = {
type WordType = {
name: string
trans: string[]
usphone: string
ukphone: string
}

const App: React.FC = () => {
Expand Down Expand Up @@ -316,6 +319,10 @@ const App: React.FC = () => {
isStart={isStart}
wordVisible={wordVisible}
/>

{(wordList[order].usphone || wordList[order].ukphone) && (
<Phonetic usphone={wordList[order].usphone} ukphone={wordList[order].ukphone} />
)}
<Translation key={`trans-${wordList[order].name}`} trans={wordList[order].trans.join(';')} />
<Speed correctCount={correctCount} inputCount={inputCount} isStart={isStart} />
</div>
Expand Down

0 comments on commit d4b7cfe

Please sign in to comment.