Skip to content

Commit

Permalink
feat(wordpage): add word count
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed Aug 26, 2018
1 parent edf76e9 commit 6667f53
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/_locales/wordpage/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,25 @@
"en": "Saladict Notebook",
"zh_CN": "Saladict 生词本",
"zh_TW": "Saladict 生字本"
},
"wordcount_selected": {
"en": "{{count}} item selected",
"zh_CN": "已选中 {{count}} 个单词",
"zh_TW": "已選中 {{count}} 個單字"
},
"wordcount_selected_plural": {
"en": "{{count}} items selected",
"zh_CN": "已选中 {{count}} 个单词",
"zh_TW": "已選中 {{count}} 個單字"
},
"wordcount_total": {
"en": "{{count}} item total",
"zh_CN": "共有 {{count}} 个单词",
"zh_TW": "共有 {{count}} 個單字"
},
"wordcount_total_plural": {
"en": "{{count}} items total",
"zh_CN": "共有 {{count}} 个单词",
"zh_TW": "共有 {{count}} 個單字"
}
}
7 changes: 7 additions & 0 deletions src/components/WordPage/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class WordPageMain extends React.Component<WordPageMainInnerProps, WordPa
current: 1,
pageSize: ITEMS_PER_PAGE,
defaultPageSize: ITEMS_PER_PAGE,
total: 0,
},
rowSelection: {
selectedRowKeys: [],
Expand Down Expand Up @@ -371,6 +372,12 @@ export class WordPageMain extends React.Component<WordPageMainInnerProps, WordPa
<Layout className='wordpage-Container'>
<Header className='wordpage-Header'>
<h1 style={{ color: '#fff' }}>{t(`title_${area}`)}</h1>
{(pagination.total as number) > 0 &&
<span className='wordpage-Wordcount'>{t(`wordcount_total`, { count: pagination.total })}</span>
}
{selectedRows.length > 0 &&
<span className='wordpage-Wordcount'>{t(`wordcount_selected`, { count: selectedRows.length })}</span>
}
<div style={{ marginLeft: 'auto' }}>
<Input
style={{ width: '15em' }}
Expand Down
7 changes: 7 additions & 0 deletions src/components/WordPage/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ textarea {
width: 100%;
}

.wordpage-Wordcount {
align-self: flex-end;
line-height: 3.3;
margin-left: 10px;
color: #fff;
}

.wordpage-Content {
background: #fff;
}
Expand Down

0 comments on commit 6667f53

Please sign in to comment.