/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/pages/showcase/_components/OperatorButton/index.tsx
41 строка
1 KB
Sébastien Lorber
refactor(website): refactor showcase components (#10023)
10 апр 2024, 11:42
Не верифицирован
10 апр 2024, 11:42
964a4e4
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {useId} from 'react'; import clsx from 'clsx'; import {useOperator} from '../../_utils'; import styles from './styles.module.css'; export default function OperatorButton() { const id = useId(); const [operator, toggleOperator] = useOperator(); // TODO add translations return ( <> <input id={id} type="checkbox" className="screen-reader-only" aria-label="Toggle between or and and for the tags you selected" checked={operator === 'AND'} onChange={toggleOperator} onKeyDown={(e) => { if (e.key === 'Enter') { toggleOperator(); } }} /> <label htmlFor={id} className={clsx(styles.checkboxLabel, 'shadow--md')}> {/* eslint-disable @docusaurus/no-untranslated-text */} <span className={styles.checkboxLabelOr}>OR</span> <span className={styles.checkboxLabelAnd}>AND</span> {/* eslint-enable @docusaurus/no-untranslated-text */} </label> </> ); }