react-icons/io#IoMdSettings TypeScript Examples

The following examples show how to use react-icons/io#IoMdSettings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SettingsButton.tsx    From nextclade with MIT License 4 votes vote down vote up
export function SettingsButton() {
  const { t } = useTranslationSafe()

  const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useRecoilState(isSettingsDialogOpenAtom)
  const [showWhatsnewOnUpdate, setShowWhatsnewOnUpdate] = useRecoilState(changelogShouldShowOnUpdatesAtom)

  const toggleOpen = useCallback(
    () => setIsSettingsDialogOpen(!isSettingsDialogOpen),
    [setIsSettingsDialogOpen, isSettingsDialogOpen],
  )

  const text = useMemo(() => t('Settings'), [t])
  const closeText = useMemo(() => t('Close this window'), [t])

  return (
    <>
      <ButtonSettingsBase type="button" onClick={toggleOpen} title={text}>
        <IoMdSettings className="mr-xl-2" />
        <span className="d-none d-xl-inline">{text}</span>
      </ButtonSettingsBase>

      <Modal backdrop="static" centered isOpen={isSettingsDialogOpen} toggle={toggleOpen} fade={false}>
        <ModalHeader toggle={toggleOpen} tag="div">
          <h3 className="text-center">{text}</h3>
        </ModalHeader>

        <ModalBody>
          <Container>
            <Row>
              <Col>
                <CardL2>
                  <CardL2Header>{t('System')}</CardL2Header>
                  <CardL2Body>
                    <SystemSettings />
                  </CardL2Body>
                </CardL2>
              </Col>
            </Row>
            <Row noGutters>
              <Col>
                <CardL2>
                  <CardL2Header>{t('Sequence view markers')}</CardL2Header>
                  <CardL2Body>
                    <SeqViewSettings />
                  </CardL2Body>
                </CardL2>
              </Col>
            </Row>
            <Row noGutters>
              <Col>
                <CardL2>
                  <CardL2Header>{t('Other settings')}</CardL2Header>
                  <CardL2Body>
                    <FormGroup>
                      <Toggle
                        identifier={'settings-show-whatsnew-toggle'}
                        checked={showWhatsnewOnUpdate}
                        onCheckedChanged={setShowWhatsnewOnUpdate}
                      >
                        {t(`Show "What's new" dialog after each update`)}
                      </Toggle>
                    </FormGroup>
                  </CardL2Body>
                </CardL2>
              </Col>
            </Row>
          </Container>
        </ModalBody>

        <ModalFooter>
          <Container fluid>
            <Row noGutters className="my-2">
              <Col className="d-flex w-100">
                <ButtonOk className="ml-auto" type="button" color="success" onClick={toggleOpen} title={closeText}>
                  {t('OK')}
                </ButtonOk>
              </Col>
            </Row>
          </Container>
        </ModalFooter>
      </Modal>
    </>
  )
}