-
Notifications
You must be signed in to change notification settings - Fork 51
/
MTMerge.story.tsx
109 lines (104 loc) · 3.79 KB
/
MTMerge.story.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '@storybook/addon-actions'
import { MTMergeOptions } from './MTMergeOptions'
import { Locale, LocaleId } from '../../utils/prop-types-util'
import { MTMergeModal } from './MTMergeModal'
import { STATUS_NEEDS_WORK } from '../../editor/utils/phrase'
class LocaleImpl implements Locale {
readonly localeId: LocaleId
readonly displayName: string
readonly nativeName: string
constructor (localeId: LocaleId, displayName: string) {
this.localeId = localeId
this.displayName = displayName
this.nativeName = displayName
}
}
function testLocale(code: LocaleId, displayName: string) {
return new LocaleImpl(code, displayName)
}
const testLocales: Locale[] = [
testLocale('ar-SA', 'Arabic (Saudi Arabia)'),
testLocale('da-DK', 'Danish (Denmark)'),
testLocale('de-DE', 'German (Germany)'),
testLocale('el-GR', 'Modern Greek (Greece)'),
testLocale('en-AU', 'English (Australia)'),
testLocale('en-GB', 'English (United Kingdom)'),
testLocale('en-IE', 'English (Ireland)'),
testLocale('en-US', 'English (United States)'),
testLocale('en-ZA', 'English (South Africa)'),
testLocale('es-ES', 'Spanish (Spain)'),
testLocale('es-MX', 'Spanish (Mexico)'),
testLocale('fi-FI', 'Finnish (Finland)'),
testLocale('fr-CA', 'French (Canada)'),
testLocale('fr-FR', 'French (France)'),
testLocale('he-IL', 'Hebrew (Israel)'),
testLocale('hi-IN', 'Hindi (India)'),
testLocale('hu-HU', 'Hungarian (Hungary)'),
testLocale('id-ID', 'Indonesian (Indonesia)'),
testLocale('it-IT', 'Italian (Italy)'),
testLocale('ja-JP', 'Japanese (Japan)'),
testLocale('ko-KR', 'Korean (Republic of Korea)'),
testLocale('nl-BE', 'Dutch (Belgium)'),
testLocale('nl-NL', 'Dutch (Netherlands)'),
testLocale('no-NO', 'Norwegian (Norway)'),
testLocale('pl-PL', 'Polish (Poland)'),
testLocale('pt-BR', 'Portuguese (Brazil)'),
testLocale('pt-PT', 'Portuguese (Portugal)'),
testLocale('ro-RO', 'Romanian (Romania)'),
testLocale('ru-RU', 'Russian (Russian Federation)'),
testLocale('sk-SK', 'Slovak (Slovakia)'),
testLocale('sv-SE', 'Swedish (Sweden)'),
testLocale('th-TH', 'Thai (Thailand)'),
testLocale('tr-TR', 'Turkish (Turkey)'),
testLocale('zh-CN', 'Chinese (China)'),
testLocale('zh-HK', 'Chinese (Hong Kong)'),
testLocale('zh-TW', 'Chinese (Taiwan)'),
testLocale('cs-CZ', 'Czech (Czech Republic)'),
]
storiesOf('MTMerge', module)
// .add('multiple', () => (
// <MTMergeOptions
// allowMultiple={true}
// availableLocales={testLocales}
// checkedLocales={[]}
// saveAs={STATUS_NEEDS_WORK}
// overwriteFuzzy={false}
// projectSlug='myProject'
// versionSlug='myVersion'
// onLocaleChange={action('onLocaleChange')}
// onOverwriteFuzzyChange={action('onOverwriteFuzzyChange')}
// onSaveAsChange={action('onSaveAsChange')}
// />
// ))
.add('single', () => (
<MTMergeOptions
allowMultiple={false}
availableLocales={testLocales}
checkedLocales={[]}
saveAs={STATUS_NEEDS_WORK}
overwriteFuzzy={false}
projectSlug='myProject'
versionSlug='myVersion'
onLocaleChange={action('onLocaleChange')}
onOverwriteFuzzyChange={action('onOverwriteFuzzyChange')}
onSaveAsChange={action('onSaveAsChange')}
/>
))
storiesOf('MTMergeModal', module)
.add('single', () => (
<MTMergeModal
processStatus={undefined}
allowMultiple={false}
show={true}
availableLocales={testLocales}
projectSlug='myProject'
versionSlug='myVersion'
onCancel={action('onCancel')}
onCancelMTMerge={action('onCancelMTMerge')}
onSubmit={action('onSubmit')}
mergeProcessFinished={action('mergeProcessFinished')}
queryMTMergeProgress={action('queryMTMergeProgress')}
/>
))