Skip to content

Commit 61297c3

Browse files
committed
extended the @basis argument to accept also the 0 (numeric) value
1 parent 5a69a27 commit 61297c3

File tree

1 file changed

+5
-2
lines changed
  • packages/components/src/components/hds/layout/flex

1 file changed

+5
-2
lines changed

packages/components/src/components/hds/layout/flex/item.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type AvailableElements = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
1313
export interface HdsLayoutFlexItemSignature {
1414
Args: {
1515
tag?: AvailableTagNames;
16-
basis?: string;
16+
basis?: string | 0;
1717
grow?: boolean | number | string;
1818
shrink?: boolean | number | string;
1919
};
@@ -36,7 +36,10 @@ export default class HdsLayoutFlexItem extends Component<HdsLayoutFlexItemSignat
3636
} = {};
3737

3838
// we handle all cases of `basis` values via inline styles
39-
if (this.args.basis) {
39+
if (typeof this.args.basis === 'number' && this.args.basis === 0) {
40+
// the `{{style}}` modifier accepts only strings
41+
inlineStyles['flex-basis'] = this.args.basis.toString();
42+
} else if (typeof this.args.basis === 'string') {
4043
inlineStyles['flex-basis'] = this.args.basis;
4144
}
4245

0 commit comments

Comments
 (0)