From 31b0d06fd7cea76e462c53875a02d8593fedb2fb Mon Sep 17 00:00:00 2001 From: "Timothy Z." Date: Fri, 29 Nov 2024 14:21:53 +0200 Subject: [PATCH] remove: checkbox component --- src/common/Checkbox/Checkbox.less | 77 ------------------------------- src/common/Checkbox/Checkbox.tsx | 65 -------------------------- src/common/Checkbox/index.ts | 5 -- src/common/index.js | 2 - 4 files changed, 149 deletions(-) delete mode 100644 src/common/Checkbox/Checkbox.less delete mode 100644 src/common/Checkbox/Checkbox.tsx delete mode 100644 src/common/Checkbox/index.ts diff --git a/src/common/Checkbox/Checkbox.less b/src/common/Checkbox/Checkbox.less deleted file mode 100644 index ed0b9954e..000000000 --- a/src/common/Checkbox/Checkbox.less +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2017-2024 Smart code 203358507 - -.checkbox { - display: flex; - align-items: center; - - label { - display: flex; - align-items: center; - cursor: pointer; - - .checkbox-checked { - .checkbox-container { - background-color: var(--primary-accent-color); - border-color: var(--primary-accent-color); - } - - .checkbox-icon { - color: var(--secondary-foreground-color); - } - } - - .checkbox-unchecked { - .checkbox-container { - background-color: transparent; - border-color: var(--primary-accent-color); - } - } - - .checkbox-disabled { - cursor: not-allowed; - - .checkbox-container { - cursor: not-allowed; - } - } - - .checkbox-error { - .checkbox-container { - border-color: var(--color-reddit); - } - } - - .checkbox-container { - position: relative; - width: 1.25rem; - height: 1.25rem; - border: 2px solid var(--primary-accent-color); - border-radius: 0.25rem; - background-color: transparent; - display: flex; - align-items: center; - justify-content: center; - transition: all 0.2s ease-in-out; - cursor: pointer; - outline: none; - user-select: none; - - &:focus { - outline: var(--focus-outline-size) solid var(--primary-accent-color); - outline-offset: 2px; - } - - input[type='checkbox'] { - opacity: 0; - width: 0; - height: 0; - position: absolute; - } - - .checkbox-icon { - color: var(--primary-background-color); - width: 1rem; - } - } - } -} \ No newline at end of file diff --git a/src/common/Checkbox/Checkbox.tsx b/src/common/Checkbox/Checkbox.tsx deleted file mode 100644 index 770654837..000000000 --- a/src/common/Checkbox/Checkbox.tsx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2017-2024 Smart code 203358507 - -import React, { useCallback, DetailedHTMLProps, HTMLAttributes, ChangeEvent } from 'react'; -import classNames from 'classnames'; -import styles from './Checkbox.less'; -import Icon from '@stremio/stremio-icons/react'; - -type Props = { - disabled?: boolean; - checked?: boolean; - className?: string; - onChange?: (checked: boolean) => void; - ariaLabel?: string; - error?: string; -}; - -const Checkbox = ({ disabled, checked, className, onChange, ariaLabel, error }: Props) => { - - const handleChangeCheckbox = useCallback(({ target }: ChangeEvent) => { - onChange && onChange(target.checked); - }, [onChange]); - - const onKeyDown = useCallback(({ key }: DetailedHTMLProps, HTMLDivElement>) => { - if ((key === 'Enter' || key === ' ') && !disabled) { - onChange && onChange(!checked); - } - }, [disabled, checked, onChange]); - - return ( -
- -
- ); -}; - -export default Checkbox; diff --git a/src/common/Checkbox/index.ts b/src/common/Checkbox/index.ts deleted file mode 100644 index 40b9097d9..000000000 --- a/src/common/Checkbox/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2017-2024 Smart code 203358507 - -import Checkbox from './Checkbox'; - -export default Checkbox; diff --git a/src/common/index.js b/src/common/index.js index 720226eb8..0605a3f9b 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -48,7 +48,6 @@ const useStreamingServer = require('./useStreamingServer'); const useTorrent = require('./useTorrent'); const useTranslate = require('./useTranslate'); const EventModal = require('./EventModal'); -const { default: Checkbox } = require('./Checkbox'); module.exports = { AddonDetailsModal, @@ -80,7 +79,6 @@ module.exports = { SharePrompt, Slider, TextInput, - Checkbox, ToastProvider, useToast, TooltipProvider,