From c184faf01765e3e8c1301886c651e9be956349a8 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 18 Sep 2022 03:45:21 +0200 Subject: [PATCH] Use dropdown for fiat selection in settings --- components/form.js | 32 +++++++++++++++++++++++++------- pages/settings.js | 6 ++++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/components/form.js b/components/form.js index e2a2a322..233c28ad 100644 --- a/components/form.js +++ b/components/form.js @@ -6,7 +6,7 @@ import { Formik, Form as FormikForm, useFormikContext, useField, FieldArray } fr import React, { useEffect, useRef, useState } from 'react' import copy from 'clipboard-copy' 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 styles from './form.module.css' import Text from '../components/text' @@ -269,10 +269,10 @@ export function InputUserSuggest ({ label, groupClassName, ...props }) { } }} /> - 0}> - + 0}> + {suggestions.array.map((v, i) => - { @@ -281,9 +281,9 @@ export function InputUserSuggest ({ label, groupClassName, ...props }) { }} > {v.name} - )} - - + )} + + ) } @@ -429,3 +429,21 @@ export function SyncForm ({ ) } + +export function Dropdown ({ label, items, groupClassName, ...props }) { + const [field, _, helper] = useField({ ...props, type: 'input' }) + return ( + + + + {field.value} + + + {items.map(item => ( + helper.setValue(item)}>{item} + ))} + + + + ) +} \ No newline at end of file diff --git a/pages/settings.js b/pages/settings.js index 5d8a67b8..993fc8ee 100644 --- a/pages/settings.js +++ b/pages/settings.js @@ -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 { Alert, Button, InputGroup, Modal } from 'react-bootstrap' import LayoutCenter from '../components/layout-center' @@ -82,9 +82,11 @@ export default function Settings ({ data: { settings } }) { autoFocus append={sats} /> -
notify me when ...