Skip to content

Commit

Permalink
feat(flat-component): Add disabled mode to ClassPicker component. (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheerego7 committed May 27, 2021
1 parent 9e3271e commit a6916fc
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ LargeMode.parameters = {
defaultViewport: "large",
},
};

export const DisabledLargeMode: Story<ClassPickerProps> = args => {
const [classType, setClassType] = useState<ClassPickerItemType>("BigClass");
return <ClassPicker {...args} value={classType} onChange={setClassType} />;
};
DisabledLargeMode.argTypes = {
type: {
control: false,
},
};
DisabledLargeMode.args = {
large: true,
disabled: true,
};
DisabledLargeMode.parameters = {
viewport: {
defaultViewport: "large",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,45 @@
}
}
}

.ant-radio-wrapper-disabled {
opacity: 0.4;
cursor: default;

> .ant-radio-disabled .ant-radio-input {
cursor: default;
}

&.ant-radio-wrapper-checked {
opacity: 1;

&:hover,
&:active {
&::after {
border: 2px solid @primary-color;
}
}

> .ant-radio-checked .ant-radio-inner {
background-color: unset;
border-color: #3381ff !important;

&::after {
background-color: #3381ff;
}
}
}

&::after {
transition: none;
}

&.ant-radio-checked,
&:hover,
&:active {
&::after {
border: 1px solid #dbe1ea;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export type { ClassPickerItemType } from "./ClassPickerItem";
export interface ClassPickerProps {
value?: ClassPickerItemType;
large?: boolean;
disabled?: boolean;
onChange?: (value: ClassPickerItemType) => void;
}

export const ClassPicker: React.FC<ClassPickerProps> = ({ value, onChange, large }) => {
export const ClassPicker: React.FC<ClassPickerProps> = ({ value, onChange, large, disabled }) => {
return (
<Radio.Group
disabled={disabled}
className={classNames("class-picker-container", {
"class-large-picker-container": large,
})}
Expand Down

0 comments on commit a6916fc

Please sign in to comment.