mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
CheckboxLabel implemented
This commit is contained in:
parent
da2f1c2682
commit
17b0874f1a
3 changed files with 60 additions and 0 deletions
25
src/routes/Intro/CheckboxLabel/CheckboxLabel.js
Normal file
25
src/routes/Intro/CheckboxLabel/CheckboxLabel.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { Checkbox } from 'stremio-common';
|
||||
import styles from './styles';
|
||||
|
||||
const CheckboxLabel = React.forwardRef(({ className, label, link, href, checked, onClick }, ref) => (
|
||||
<label className={classnames(styles['checkbox-label-container'], className)}>
|
||||
<div className={styles['checkbox-container']}>
|
||||
<Checkbox ref={ref} className={styles['checkbox']} checked={checked} onClick={onClick} />
|
||||
</div>
|
||||
<div className={styles['label']}>
|
||||
{label}
|
||||
{link ? <a className={styles['link']} href={href} target={'_blank'} tabIndex={'-1'}> {link}</a> : null}
|
||||
</div>
|
||||
</label>
|
||||
));
|
||||
|
||||
CheckboxLabel.propTypes = {
|
||||
className: PropTypes.string
|
||||
};
|
||||
|
||||
CheckboxLabel.displayName = 'CheckboxLabel';
|
||||
|
||||
export default CheckboxLabel;
|
||||
3
src/routes/Intro/CheckboxLabel/index.js
Normal file
3
src/routes/Intro/CheckboxLabel/index.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import CheckboxLabel from './CheckboxLabel';
|
||||
|
||||
export default CheckboxLabel;
|
||||
32
src/routes/Intro/CheckboxLabel/styles.less
Normal file
32
src/routes/Intro/CheckboxLabel/styles.less
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
.checkbox-label-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
cursor: pointer;
|
||||
|
||||
.checkbox-container {
|
||||
margin-right: calc(var(--spacing) * 0.5);
|
||||
|
||||
.checkbox {
|
||||
width: var(--spacing);
|
||||
height: var(--spacing);
|
||||
fill: var(--color-surface);
|
||||
|
||||
&:global(.checked) {
|
||||
fill: var(--color-surfacelight);
|
||||
background-color: var(--color-primary);
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
fill: var(--color-surfacelighter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--color-surface);
|
||||
}
|
||||
|
||||
.link {
|
||||
color: var(--color-surfacelighter);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue