Button improvements
* Allow for passing className to left and right accessory * Rename contained to bound * Rename buttonSize to size * Add custom button styles
This commit is contained in:
parent
7baa9dddd9
commit
3434e7042c
2 changed files with 52 additions and 11 deletions
|
|
@ -70,6 +70,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.bound.blended {
|
||||||
|
background: var(--dialog-bg);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--input-bound-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.floating {
|
&.floating {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
@ -77,6 +85,29 @@
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.jobAccessory.icon {
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 99px;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
padding: $unit * 1.5;
|
||||||
|
top: $unit;
|
||||||
|
left: $unit;
|
||||||
|
height: auto;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
&:hover .accessory svg,
|
||||||
|
&.selected .accessory svg {
|
||||||
|
fill: var(--button-text-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.accessory svg {
|
||||||
|
fill: var(--button-text);
|
||||||
|
width: $unit-3x;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sizes
|
// Sizes
|
||||||
&.icon {
|
&.icon {
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
|
|
@ -246,10 +277,14 @@
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&.Arrow {
|
&.arrow {
|
||||||
margin-top: $unit-half;
|
margin-top: $unit-half;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.flipped {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
fill: var(--button-text);
|
fill: var(--button-text);
|
||||||
height: $dimension;
|
height: $dimension;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ interface Props
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
active: false,
|
active: false,
|
||||||
blended: false,
|
blended: false,
|
||||||
contained: false,
|
bound: false,
|
||||||
floating: false,
|
floating: false,
|
||||||
buttonSize: 'medium' as const,
|
size: 'medium' as const,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Button = React.forwardRef<HTMLButtonElement, Props>(function button(
|
const Button = React.forwardRef<HTMLButtonElement, Props>(function button(
|
||||||
|
|
@ -59,15 +59,21 @@ const Button = React.forwardRef<HTMLButtonElement, Props>(function button(
|
||||||
props.className?.split(' ').map((className) => styles[className])
|
props.className?.split(' ').map((className) => styles[className])
|
||||||
)
|
)
|
||||||
|
|
||||||
const leftAccessoryClasses = classNames(leftAccessoryClassName, {
|
const leftAccessoryClasses = classNames(
|
||||||
|
{
|
||||||
[styles.accessory]: true,
|
[styles.accessory]: true,
|
||||||
[styles.left]: true,
|
[styles.left]: true,
|
||||||
})
|
},
|
||||||
|
leftAccessoryClassName?.split(' ').map((className) => styles[className])
|
||||||
|
)
|
||||||
|
|
||||||
const rightAccessoryClasses = classNames(rightAccessoryClassName, {
|
const rightAccessoryClasses = classNames(
|
||||||
|
{
|
||||||
[styles.accessory]: true,
|
[styles.accessory]: true,
|
||||||
[styles.right]: true,
|
[styles.right]: true,
|
||||||
})
|
},
|
||||||
|
rightAccessoryClassName?.split(' ').map((className) => styles[className])
|
||||||
|
)
|
||||||
|
|
||||||
const hasLeftAccessory = () => {
|
const hasLeftAccessory = () => {
|
||||||
if (leftAccessoryIcon)
|
if (leftAccessoryIcon)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue