Skip to content

Commit 8e49157

Browse files
committed
move variant setting to filterPRops
1 parent b2d78dc commit 8e49157

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"**/*.js": true
2222
},
2323
"editor.codeActionsOnSave": {
24-
"source.fixAll.eslint": true
24+
"source.fixAll.eslint": "explicit"
2525
},
2626
"editor.formatOnSave": true,
2727
"[typescriptreact]": {

src/hooks/useRestyle.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ const filterRestyleProps = <
1212
componentProps: TProps,
1313
omitPropertiesMap: {[key in keyof TProps]: boolean},
1414
) => {
15-
const cleanProps: TProps = {} as TProps;
15+
const cleanProps: TProps & {variant?: unknown} = {} as TProps;
1616
const restyleProps: TProps & {variant?: unknown} = {} as TProps;
1717
let serializedRestyleProps = '';
18+
1819
if (omitPropertiesMap.variant) {
1920
restyleProps.variant = componentProps.variant ?? 'defaults';
21+
cleanProps.variant = restyleProps.variant;
2022
}
2123
for (const key in componentProps) {
2224
if (omitPropertiesMap[key as keyof TProps]) {
@@ -26,7 +28,6 @@ const filterRestyleProps = <
2628
cleanProps[key] = componentProps[key];
2729
}
2830
}
29-
3031
const keys = {cleanProps, restyleProps, serializedRestyleProps};
3132
return keys;
3233
};
@@ -93,9 +94,6 @@ const useRestyle = <
9394
]);
9495

9596
cleanProps.style = calculatedStyle;
96-
if (restyleProps.variant) {
97-
(cleanProps as TProps & {variant?: unknown}).variant = restyleProps.variant;
98-
}
9997
return cleanProps;
10098
};
10199

0 commit comments

Comments
 (0)