feat: use new constants instead of magic strings
This commit is contained in:
parent
dd715fb6cc
commit
0e5062d1a5
|
@ -5,9 +5,10 @@ import { Text } from '@status-im/components'
|
||||||
import KeyFiles from './KeyFiles'
|
import KeyFiles from './KeyFiles'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import RecoveryPhrase from './RecoveryPhrase'
|
import RecoveryPhrase from './RecoveryPhrase'
|
||||||
|
import { KEY_FILES, RECOVERY_PHRASE } from '../../../constants'
|
||||||
|
|
||||||
const KeyGeneration = () => {
|
const KeyGeneration = () => {
|
||||||
const [selectedRecoveryMechanism, setSelectedRecoveryMechanism] = useState('Key Files')
|
const [selectedRecoveryMechanism, setSelectedRecoveryMechanism] = useState(KEY_FILES)
|
||||||
|
|
||||||
const handleRecoveryMechanismChange = (value: string) => {
|
const handleRecoveryMechanismChange = (value: string) => {
|
||||||
setSelectedRecoveryMechanism(value)
|
setSelectedRecoveryMechanism(value)
|
||||||
|
@ -23,8 +24,8 @@ const KeyGeneration = () => {
|
||||||
<Text size={27} weight={'semibold'}>
|
<Text size={27} weight={'semibold'}>
|
||||||
4 Validators
|
4 Validators
|
||||||
</Text>
|
</Text>
|
||||||
{selectedRecoveryMechanism === 'Key Files' && <KeyFiles />}
|
{selectedRecoveryMechanism === KEY_FILES && <KeyFiles />}
|
||||||
{selectedRecoveryMechanism === 'Recovery Phrase' && <RecoveryPhrase />}
|
{selectedRecoveryMechanism === RECOVERY_PHRASE && <RecoveryPhrase />}
|
||||||
</YStack>
|
</YStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react'
|
import type { Meta, StoryObj } from '@storybook/react'
|
||||||
|
|
||||||
import RecoveryMechanism from './RecoveryMechanism'
|
import RecoveryMechanism from './RecoveryMechanism'
|
||||||
|
import { KEY_FILES } from '../../../constants'
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'ValidatorOnboarding/RecoveryMechanism',
|
title: 'ValidatorOnboarding/RecoveryMechanism',
|
||||||
|
@ -17,7 +18,7 @@ type Story = StoryObj<typeof meta>
|
||||||
|
|
||||||
export const Page: Story = {
|
export const Page: Story = {
|
||||||
args: {
|
args: {
|
||||||
selectedRecoveryMechanism: 'Key Files',
|
selectedRecoveryMechanism: KEY_FILES,
|
||||||
handleRecoveryMechanismChange: () => {},
|
handleRecoveryMechanismChange: () => {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Text } from '@status-im/components'
|
import { Text } from '@status-im/components'
|
||||||
import { XStack, YStack } from 'tamagui'
|
import { XStack, YStack } from 'tamagui'
|
||||||
import RecoveryMechanismCard from './RecoveryMechanismCard'
|
import RecoveryMechanismCard from './RecoveryMechanismCard'
|
||||||
|
import { BOTH_KEY_AND_RECOVERY, KEY_FILES, RECOVERY_PHRASE } from '../../../constants'
|
||||||
|
|
||||||
type RecoveryMechanismProps = {
|
type RecoveryMechanismProps = {
|
||||||
selectedRecoveryMechanism: string
|
selectedRecoveryMechanism: string
|
||||||
|
@ -18,17 +19,17 @@ const RecoveryMechanism = ({
|
||||||
</Text>
|
</Text>
|
||||||
<XStack space={'$4'} style={{ justifyContent: 'space-between', marginTop: '40px' }}>
|
<XStack space={'$4'} style={{ justifyContent: 'space-between', marginTop: '40px' }}>
|
||||||
<RecoveryMechanismCard
|
<RecoveryMechanismCard
|
||||||
value="Key Files"
|
value={KEY_FILES}
|
||||||
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
||||||
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
||||||
/>
|
/>
|
||||||
<RecoveryMechanismCard
|
<RecoveryMechanismCard
|
||||||
value="Recovery Phrase"
|
value={RECOVERY_PHRASE}
|
||||||
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
||||||
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
||||||
/>
|
/>
|
||||||
<RecoveryMechanismCard
|
<RecoveryMechanismCard
|
||||||
value="Both Key Files & Recovery Phrase"
|
value={BOTH_KEY_AND_RECOVERY}
|
||||||
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
selectedRecoveryMechanism={selectedRecoveryMechanism}
|
||||||
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
handleRecoveryMechanismChange={handleRecoveryMechanismChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react'
|
import type { Meta, StoryObj } from '@storybook/react'
|
||||||
|
|
||||||
import RecoveryMechanismCard from './RecoveryMechanismCard'
|
import RecoveryMechanismCard from './RecoveryMechanismCard'
|
||||||
|
import { KEY_FILES } from '../../../constants'
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'ValidatorOnboarding/RecoveryMechanismCard',
|
title: 'ValidatorOnboarding/RecoveryMechanismCard',
|
||||||
|
@ -17,8 +18,8 @@ type Story = StoryObj<typeof meta>
|
||||||
|
|
||||||
export const Page: Story = {
|
export const Page: Story = {
|
||||||
args: {
|
args: {
|
||||||
value: 'Key Files',
|
value: KEY_FILES,
|
||||||
selectedRecoveryMechanism: 'Key Files',
|
selectedRecoveryMechanism: KEY_FILES,
|
||||||
handleRecoveryMechanismChange: () => {},
|
handleRecoveryMechanismChange: () => {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue