Skip to content

Commit 68424ca

Browse files
committed
fix: size checkbox
1 parent 459400d commit 68424ca

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@beeinventor/dasiot-react-component-lib",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"module": "lib/index.js",
55
"types": "lib/index.d.ts",
66
"files": [

src/components/Dropdown/DropdownCheckbox/DropdownCheckbox.stories.tsx

+20-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ const list: DropdownCheckboxItem[] = [
2222
value: 'floor-3',
2323
name: 'Floor 3',
2424
},
25+
{
26+
id: 'floor-4',
27+
value: 'floor-4',
28+
name: 'Floor 4',
29+
},
30+
{
31+
id: 'floor-5',
32+
value: 'floor-5',
33+
name: 'Floor 5',
34+
},
35+
{
36+
id: 'floor-6',
37+
value: 'floor-6',
38+
name: 'Floor 6',
39+
},
2540
];
2641

2742
export default {
@@ -52,7 +67,10 @@ export default {
5267
} as Meta;
5368

5469
export const Default: Story<DropdownCheckboxProps> = (args) => {
55-
const [selectedIds, setSelectedIds] = useState<string[]>();
70+
const [selectedIds, setSelectedIds] = useState<string[]>([
71+
list[0].value as string,
72+
list[1].value as string,
73+
]);
5674

5775
return (
5876
<div>
@@ -68,5 +86,6 @@ export const Default: Story<DropdownCheckboxProps> = (args) => {
6886
Default.args = {
6987
mode: 'dark',
7088
list,
89+
7190
placeholder: 'Please Select Item',
7291
};

src/components/Dropdown/DropdownCheckbox/DropdownCheckbox.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ const Item = styled(Box, { label: 'Dropdown-item' })<ItemProps>(
5757
({ theme, selected }) => ({
5858
...theme.typography.h3,
5959
cursor: 'pointer',
60-
display: 'flex',
61-
alignItems: 'center',
62-
lineHeight: 2.5,
60+
// display: 'flex',
61+
// alignItems: 'center',
62+
// lineHeight: 2.5,
6363
'&:hover': {
6464
backgroundColor: 'rgba(0, 0, 0, .05)',
6565
},
@@ -70,6 +70,10 @@ const Item = styled(Box, { label: 'Dropdown-item' })<ItemProps>(
7070
const ContainerLabel = styled('div')`
7171
display: flex;
7272
align-items: center;
73+
max-width: 320px;
74+
overflow: hidden;
75+
white-space: nowrap;
76+
text-overflow: ellipsis;
7377
gap: 10px;
7478
`;
7579

@@ -108,6 +112,8 @@ const DropdownCheckbox: React.VFC<DropdownCheckboxProps> = (props) => {
108112
useEffect(() => {
109113
if (selectedIds === undefined || selectedIds.length === 0) {
110114
setItemChecked([]);
115+
} else {
116+
setItemChecked(selectedIds);
111117
}
112118
}, [selectedIds]);
113119

@@ -127,7 +133,7 @@ const DropdownCheckbox: React.VFC<DropdownCheckboxProps> = (props) => {
127133
.map((item) => (
128134
<Item
129135
key={`dropdown-item-${item.id}`}
130-
className="Dropdown-item"
136+
// className="Dropdown-item"
131137
selected={itemChecked.includes(item.value as string)}
132138
{...itemProps}
133139
>

0 commit comments

Comments
 (0)