mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix(Checkbox): use checkmark icon instead of styles and make bg color the primary accent one
This commit is contained in:
parent
e3fda56a11
commit
71bd470d31
2 changed files with 12 additions and 30 deletions
|
|
@ -30,9 +30,10 @@
|
|||
position: relative;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
border: 0.2rem solid var(--color-placeholder);
|
||||
border: 0.2rem solid var(--primary-accent-color);
|
||||
border-radius: 0.5rem;
|
||||
background-color: transparent;
|
||||
padding: 0.1rem;
|
||||
display: flex;
|
||||
flex: none;
|
||||
margin-right: 1rem;
|
||||
|
|
@ -51,29 +52,9 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
background-color: transparent;
|
||||
opacity: 0;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0.45rem;
|
||||
top: 0.2rem;
|
||||
width: 0.2rem;
|
||||
height: 0.5rem;
|
||||
border: solid var(--primary-foreground-color);
|
||||
border-width: 0 0.2rem 0.2rem 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.checkbox-icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
|
|
@ -85,11 +66,7 @@
|
|||
}
|
||||
|
||||
&.checked {
|
||||
border: 3px solid var(--secondary-accent-color);
|
||||
background-color: var(--secondary-accent-color);
|
||||
.checkmark {
|
||||
opacity: 1;
|
||||
}
|
||||
background-color: var(--primary-accent-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import React, { useCallback, ChangeEvent, KeyboardEvent, RefCallback } from 'rea
|
|||
import classNames from 'classnames';
|
||||
import styles from './Checkbox.less';
|
||||
import Button from '../Button';
|
||||
import Icon from '@stremio/stremio-icons/react';
|
||||
|
||||
type Props = {
|
||||
ref?: RefCallback<HTMLInputElement>;
|
||||
|
|
@ -66,7 +67,11 @@ const Checkbox = React.forwardRef<HTMLInputElement, Props>(({ name, disabled, cl
|
|||
onChange={handleSelect}
|
||||
className={styles['input']}
|
||||
/>
|
||||
<span className={styles['checkmark']} />
|
||||
{
|
||||
checked ?
|
||||
<Icon name={'checkmark'} className={styles['checkbox-icon']} />
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
<span>{label}</span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue