Fix token styles
This commit is contained in:
parent
d786b19dc0
commit
c9b598bd53
2 changed files with 28 additions and 10 deletions
|
|
@ -1,31 +1,32 @@
|
||||||
.Token {
|
.token {
|
||||||
background: var(--input-bg);
|
background: var(--input-bg);
|
||||||
border-radius: 99px;
|
border-radius: 99px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
font-size: $font-tiny;
|
font-size: $font-tiny;
|
||||||
font-weight: $bold;
|
font-weight: $bold;
|
||||||
|
line-height: 1.4;
|
||||||
min-width: 3rem;
|
min-width: 3rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: $unit-three-fourth ($unit * 1.5);
|
padding: $unit-three-fourth ($unit * 1.5);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
&.ChargeAttack.On {
|
&.chargeAttack.on {
|
||||||
background: var(--charge-attack-bg);
|
background: var(--charge-attack-bg);
|
||||||
color: var(--charge-attack-text);
|
color: var(--charge-attack-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.FullAuto.On {
|
&.fullAuto.on,
|
||||||
|
&.autoSummon.on {
|
||||||
background: var(--full-auto-bg);
|
background: var(--full-auto-bg);
|
||||||
color: var(--full-auto-text);
|
color: var(--full-auto-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.AutoGuard.On,
|
&.autoGuard.on {
|
||||||
&.AutoSummon.On {
|
|
||||||
background: var(--auto-guard-bg);
|
background: var(--auto-guard-bg);
|
||||||
color: var(--auto-guard-text);
|
color: var(--auto-guard-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.Off {
|
&.off {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,31 @@ interface Props
|
||||||
extends React.DetailedHTMLProps<
|
extends React.DetailedHTMLProps<
|
||||||
React.HTMLAttributes<HTMLDivElement>,
|
React.HTMLAttributes<HTMLDivElement>,
|
||||||
HTMLDivElement
|
HTMLDivElement
|
||||||
> {}
|
> {
|
||||||
|
active?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
const Token = React.forwardRef<HTMLDivElement, Props>(function Token(
|
const Token = React.forwardRef<HTMLDivElement, Props>(function token(
|
||||||
{ children, className, ...props },
|
{ children, className, ...props },
|
||||||
forwardedRef
|
forwardedRef
|
||||||
) {
|
) {
|
||||||
const classes = classNames({ Token: true }, className)
|
const classes = classNames(
|
||||||
return <div className={classes}>{children}</div>
|
{
|
||||||
|
[styles.token]: true,
|
||||||
|
[styles.on]: props.active,
|
||||||
|
[styles.off]: !props.active,
|
||||||
|
},
|
||||||
|
className && styles[className]
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<div className={classes} ref={forwardedRef}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Token.defaultProps = {
|
||||||
|
active: true,
|
||||||
|
}
|
||||||
|
|
||||||
export default Token
|
export default Token
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue