Update SegmentedControl component
* Add className and blended properties * Segment gets flex-grow
This commit is contained in:
parent
c9014913db
commit
4e63a6593b
3 changed files with 32 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
.Segment {
|
.Segment {
|
||||||
color: $grey-55;
|
color: $grey-55;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
flex-grow: 1;
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
font-weight: $normal;
|
font-weight: $normal;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,15 @@
|
||||||
background: var(--card-bg);
|
background: var(--card-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.Blended {
|
||||||
|
background: var(--input-bound-bg);
|
||||||
|
border-radius: $full-corner;
|
||||||
|
|
||||||
|
.Segment input:checked + label {
|
||||||
|
background: var(--card-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.fire {
|
&.fire {
|
||||||
.Segment input:checked + label {
|
.Segment input:checked + label {
|
||||||
background: var(--fire-bg);
|
background: var(--fire-bg);
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,36 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import classNames from 'classnames'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
className?: string
|
||||||
elementClass?: string
|
elementClass?: string
|
||||||
|
blended?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const SegmentedControl: React.FC<Props> = ({ elementClass, children }) => {
|
const SegmentedControl: React.FC<Props> = ({
|
||||||
|
className,
|
||||||
|
elementClass,
|
||||||
|
blended,
|
||||||
|
children,
|
||||||
|
}) => {
|
||||||
|
const classes = classNames(
|
||||||
|
{
|
||||||
|
SegmentedControl: true,
|
||||||
|
Blended: blended,
|
||||||
|
},
|
||||||
|
className,
|
||||||
|
elementClass
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
<div className="SegmentedControlWrapper">
|
<div className="SegmentedControlWrapper">
|
||||||
<div className={`SegmentedControl ${elementClass ? elementClass : ''}`}>
|
<div className={classes}>{children}</div>
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SegmentedControl.defaultProps = {
|
||||||
|
blended: false,
|
||||||
|
}
|
||||||
|
|
||||||
export default SegmentedControl
|
export default SegmentedControl
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue