Use dropdown for fiat selection in settings
This commit is contained in:
parent
22e07a4318
commit
c184faf017
|
@ -6,7 +6,7 @@ import { Formik, Form as FormikForm, useFormikContext, useField, FieldArray } fr
|
||||||
import React, { useEffect, useRef, useState } from 'react'
|
import React, { useEffect, useRef, useState } from 'react'
|
||||||
import copy from 'clipboard-copy'
|
import copy from 'clipboard-copy'
|
||||||
import Thumb from '../svgs/thumb-up-fill.svg'
|
import Thumb from '../svgs/thumb-up-fill.svg'
|
||||||
import { Col, Dropdown, Nav } from 'react-bootstrap'
|
import { Col, Dropdown as BootstrapDropdown, Nav } from 'react-bootstrap'
|
||||||
import Markdown from '../svgs/markdown-line.svg'
|
import Markdown from '../svgs/markdown-line.svg'
|
||||||
import styles from './form.module.css'
|
import styles from './form.module.css'
|
||||||
import Text from '../components/text'
|
import Text from '../components/text'
|
||||||
|
@ -269,10 +269,10 @@ export function InputUserSuggest ({ label, groupClassName, ...props }) {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Dropdown show={suggestions.array.length > 0}>
|
<BootstrapDropdown show={suggestions.array.length > 0}>
|
||||||
<Dropdown.Menu className={styles.suggestionsMenu}>
|
<BootstrapDropdown.Menu className={styles.suggestionsMenu}>
|
||||||
{suggestions.array.map((v, i) =>
|
{suggestions.array.map((v, i) =>
|
||||||
<Dropdown.Item
|
<BootstrapDropdown.Item
|
||||||
key={v.name}
|
key={v.name}
|
||||||
active={suggestions.index === i}
|
active={suggestions.index === i}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -281,9 +281,9 @@ export function InputUserSuggest ({ label, groupClassName, ...props }) {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{v.name}
|
{v.name}
|
||||||
</Dropdown.Item>)}
|
</BootstrapDropdown.Item>)}
|
||||||
</Dropdown.Menu>
|
</BootstrapDropdown.Menu>
|
||||||
</Dropdown>
|
</BootstrapDropdown>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -429,3 +429,21 @@ export function SyncForm ({
|
||||||
</Formik>
|
</Formik>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function Dropdown ({ label, items, groupClassName, ...props }) {
|
||||||
|
const [field, _, helper] = useField({ ...props, type: 'input' })
|
||||||
|
return (
|
||||||
|
<FormGroup label={label} className={groupClassName}>
|
||||||
|
<BootstrapDropdown>
|
||||||
|
<BootstrapDropdown.Toggle>
|
||||||
|
{field.value}
|
||||||
|
</BootstrapDropdown.Toggle>
|
||||||
|
<BootstrapDropdown.Menu>
|
||||||
|
{items.map(item => (
|
||||||
|
<BootstrapDropdown.Item onSelect={() => helper.setValue(item)}>{item}</BootstrapDropdown.Item>
|
||||||
|
))}
|
||||||
|
</BootstrapDropdown.Menu>
|
||||||
|
</BootstrapDropdown>
|
||||||
|
</FormGroup>
|
||||||
|
)
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { Checkbox, Form, Input, SubmitButton } from '../components/form'
|
import { Checkbox, Form, Input, SubmitButton, Dropdown } from '../components/form'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { Alert, Button, InputGroup, Modal } from 'react-bootstrap'
|
import { Alert, Button, InputGroup, Modal } from 'react-bootstrap'
|
||||||
import LayoutCenter from '../components/layout-center'
|
import LayoutCenter from '../components/layout-center'
|
||||||
|
@ -82,9 +82,11 @@ export default function Settings ({ data: { settings } }) {
|
||||||
autoFocus
|
autoFocus
|
||||||
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Dropdown
|
||||||
label='fiat currency'
|
label='fiat currency'
|
||||||
name='fiatCurrency'
|
name='fiatCurrency'
|
||||||
|
items={supportedCurrencies}
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
<div className='form-label'>notify me when ...</div>
|
<div className='form-label'>notify me when ...</div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
Loading…
Reference in New Issue