Skip to content

Commit ed4ec90

Browse files
author
Hector Arce De Las Heras
committed
Added Width and Height Props to Dot
Properties for width and height have been introduced to the Dot component, allowing users to specify custom dimensions for this element. This enhancement makes it easier to adapt the Dot component to various design contexts, offering increased flexibility in its implementation. The properties accept numerical values, which define the width and height of the Dot in pixels.
1 parent 6e9dd23 commit ed4ec90

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

src/components/dot/dot.styled.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ export const DotStyled = styled.span<IDotStyled>`
1616
${props => getMeasuresStyles(props.sizeStyles.container)}
1717
${props => getTypographyStyles(props.sizeStyles.container)}
1818
${props => getTypographyStyles(props.styles.container)}
19+
width: ${props => props.$width};
20+
height: ${props => props.$height};
1921
`;

src/components/dot/dotStandAlone.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@ import { DotStyled } from './dot.styled';
44
import { IDotStandAlone } from './types/dot';
55

66
const DotStandAloneComponent = (
7-
{ formatedNumber, sizeStyles, styles, dataTestId = 'dot-standalone-test-id' }: IDotStandAlone,
7+
{
8+
formatedNumber,
9+
sizeStyles,
10+
styles,
11+
dataTestId = 'dot-standalone-test-id',
12+
height,
13+
width,
14+
}: IDotStandAlone,
815
ref: React.ForwardedRef<HTMLSpanElement> | undefined | null
916
): JSX.Element => {
1017
return (
11-
<DotStyled ref={ref} data-testid={dataTestId} sizeStyles={sizeStyles} styles={styles}>
18+
<DotStyled
19+
ref={ref}
20+
$height={height}
21+
$width={width}
22+
data-testid={dataTestId}
23+
sizeStyles={sizeStyles}
24+
styles={styles}
25+
>
1226
{formatedNumber}
1327
</DotStyled>
1428
);

src/components/dot/stories/argtypes.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ export const argtypes = (variants: IThemeObjectVariants, themeSelected: string):
5757
category: CATEGORY_CONTROL.CONTENT,
5858
},
5959
},
60+
width: {
61+
control: { type: 'text' },
62+
type: { name: 'string' },
63+
description: 'Add width to the dot',
64+
table: {
65+
type: {
66+
summary: 'string',
67+
},
68+
category: CATEGORY_CONTROL.MODIFIERS,
69+
},
70+
},
71+
height: {
72+
control: { type: 'text' },
73+
type: { name: 'string' },
74+
description: 'Add height to the dot',
75+
table: {
76+
type: {
77+
summary: 'string',
78+
},
79+
category: CATEGORY_CONTROL.MODIFIERS,
80+
},
81+
},
6082
dataTestId: {
6183
control: { type: 'text' },
6284
type: { name: 'string' },

src/components/dot/types/dot.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { DotSizePropsType, DotVariantStylesType } from './dotTheme';
1010
export interface IDotStyled {
1111
styles: DotVariantStylesType;
1212
sizeStyles: DotSizePropsType;
13+
$width?: string;
14+
$height?: string;
1315
}
1416

1517
/**
@@ -21,6 +23,8 @@ export interface IDotStandAlone {
2123
styles: DotVariantStylesType;
2224
sizeStyles: DotSizePropsType;
2325
formatedNumber?: number | string;
26+
width?: string;
27+
height?: string;
2428
dataTestId?: string;
2529
}
2630

0 commit comments

Comments
 (0)