mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-30 17:42:12 +03:00
fix(core): disable border thickness setting when no border is selected (#8152)
close AF-1351
This commit is contained in:
parent
6b266e3a1b
commit
a7ecfea3b5
@ -3,7 +3,13 @@ import { createVar, style } from '@vanilla-extract/css';
|
||||
|
||||
export const thumbSize = createVar();
|
||||
|
||||
export const root = style({});
|
||||
export const root = style({
|
||||
selectors: {
|
||||
'&[data-disabled]': {
|
||||
opacity: 0.5,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const trackStyle = style({
|
||||
width: '100%',
|
||||
@ -13,6 +19,11 @@ export const trackStyle = style({
|
||||
alignItems: 'center',
|
||||
padding: '12px 0',
|
||||
cursor: 'pointer',
|
||||
selectors: {
|
||||
'&[data-disabled]': {
|
||||
cursor: 'not-allowed',
|
||||
},
|
||||
},
|
||||
});
|
||||
export const fakeTrackStyle = style({
|
||||
width: `calc(100% - ${thumbSize})`,
|
||||
@ -42,6 +53,11 @@ export const thumbStyle = style({
|
||||
top: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
cursor: 'pointer',
|
||||
selectors: {
|
||||
'&[data-disabled]': {
|
||||
cursor: 'not-allowed',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const nodeStyle = style({
|
||||
@ -58,5 +74,8 @@ export const nodeStyle = style({
|
||||
'&[data-active="true"]': {
|
||||
backgroundColor: cssVarV2('icon/primary'),
|
||||
},
|
||||
'&[data-disabled="true"]': {
|
||||
cursor: 'not-allowed',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -71,6 +71,7 @@ export const Slider = ({
|
||||
thumbStyle,
|
||||
noteStyle,
|
||||
thumbSize = 14,
|
||||
disabled,
|
||||
...props
|
||||
}: SliderProps) => {
|
||||
const sliderRef = useRef<HTMLDivElement>(null);
|
||||
@ -93,6 +94,7 @@ export const Slider = ({
|
||||
style={rootStyle}
|
||||
className={styles.root}
|
||||
{...props}
|
||||
disabled={disabled}
|
||||
>
|
||||
<Sliders.Track className={styles.trackStyle} ref={sliderRef}>
|
||||
<div className={styles.fakeTrackStyle} style={trackStyle}>
|
||||
@ -108,6 +110,7 @@ export const Slider = ({
|
||||
key={index}
|
||||
className={styles.nodeStyle}
|
||||
data-active={value && value[0] >= nodeValue}
|
||||
data-disabled={disabled}
|
||||
style={{
|
||||
left: calcStepMarkOffset(
|
||||
index,
|
||||
|
@ -256,6 +256,7 @@ export const NoteSettings = () => {
|
||||
max={12}
|
||||
step={2}
|
||||
nodes={[2, 4, 6, 8, 10, 12]}
|
||||
disabled={borderStyle === StrokeStyle.None}
|
||||
/>
|
||||
</SettingRow>
|
||||
</>
|
||||
|
@ -494,6 +494,7 @@ export const ShapeSettings = () => {
|
||||
max={12}
|
||||
step={2}
|
||||
nodes={[2, 4, 6, 8, 10, 12]}
|
||||
disabled={borderStyle === StrokeStyle.None}
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingRow
|
||||
|
Loading…
Reference in New Issue
Block a user