Skip to content

Commit 1a54c66

Browse files
jkuelzmxschll
andauthored
chore: Add color prop to container style API (#4399)
Co-authored-by: Maximilian Schoell <schomax@amazon.de>
1 parent a6cdcd0 commit 1a54c66

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

pages/container/style-custom.page.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,32 @@ export default function CustomContainer() {
208208
>
209209
Container content
210210
</Container>
211+
212+
<Container
213+
header={
214+
<>
215+
<Box color="inherit">{`<Box color="inherit" />`}</Box> Plain text
216+
</>
217+
}
218+
footer={
219+
<>
220+
<Box color="inherit">{`<Box color="inherit" />`}</Box> Plain text
221+
</>
222+
}
223+
style={{
224+
root: {
225+
background: 'light-dark(#1a1f6e, #bbc2f4)',
226+
color: 'light-dark(#ffffff, #000000)',
227+
},
228+
content: {
229+
paddingBlock: '12px',
230+
},
231+
}}
232+
>
233+
<>
234+
<Box color="inherit">{`<Box color="inherit" />`}</Box> Plain text
235+
</>
236+
</Container>
211237
</SpaceBetween>
212238
</ScreenshotArea>
213239
);

src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9722,12 +9722,17 @@ Refer to the [style](/components/container/?tabId=style) tab for more details.",
97229722
"optional": true,
97239723
"type": "string",
97249724
},
9725+
{
9726+
"name": "color",
9727+
"optional": true,
9728+
"type": "string",
9729+
},
97259730
],
97269731
"type": "object",
97279732
},
97289733
"name": "root",
97299734
"optional": true,
9730-
"type": "{ background?: string | undefined; borderColor?: string | undefined; borderRadius?: string | undefined; borderWidth?: string | undefined; boxShadow?: string | undefined; }",
9735+
"type": "{ background?: string | undefined; borderColor?: string | undefined; borderRadius?: string | undefined; borderWidth?: string | undefined; boxShadow?: string | undefined; color?: string | undefined; }",
97319736
},
97329737
],
97339738
"type": "object",
@@ -27202,12 +27207,17 @@ Refer to the [style](/components/tabs/?tabId=style) tab for more details.",
2720227207
"optional": true,
2720327208
"type": "string",
2720427209
},
27210+
{
27211+
"name": "color",
27212+
"optional": true,
27213+
"type": "string",
27214+
},
2720527215
],
2720627216
"type": "object",
2720727217
},
2720827218
"name": "root",
2720927219
"optional": true,
27210-
"type": "{ background?: string | undefined; borderColor?: string | undefined; borderRadius?: string | undefined; borderWidth?: string | undefined; boxShadow?: string | undefined; }",
27220+
"type": "{ background?: string | undefined; borderColor?: string | undefined; borderRadius?: string | undefined; borderWidth?: string | undefined; boxShadow?: string | undefined; color?: string | undefined; }",
2721127221
},
2721227222
],
2721327223
"type": "object",

src/container/__tests__/__snapshots__/styles.test.tsx.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ exports[`getRootStyles handles all possible style configurations 1`] = `
128128
"borderRadius": undefined,
129129
"borderWidth": undefined,
130130
"boxShadow": undefined,
131+
"color": undefined,
131132
}
132133
`;
133134

@@ -138,6 +139,7 @@ exports[`getRootStyles handles all possible style configurations 2`] = `
138139
"borderRadius": undefined,
139140
"borderWidth": undefined,
140141
"boxShadow": undefined,
142+
"color": undefined,
141143
}
142144
`;
143145

@@ -148,5 +150,6 @@ exports[`getRootStyles handles all possible style configurations 3`] = `
148150
"borderRadius": "8px",
149151
"borderWidth": "1px",
150152
"boxShadow": "0 1px 3px rgba(0,0,0,0.1)",
153+
"color": "#000000",
151154
}
152155
`;

src/container/__tests__/styles.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const allStyles = {
1313
borderRadius: '8px',
1414
borderWidth: '1px',
1515
boxShadow: '0 1px 3px rgba(0,0,0,0.1)',
16+
color: '#000000',
1617
},
1718
content: {
1819
paddingBlock: '16px',

src/container/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export namespace ContainerProps {
131131
borderRadius?: string;
132132
borderWidth?: string;
133133
boxShadow?: string;
134+
color?: string;
134135
};
135136
content?: {
136137
paddingBlock?: string;

src/container/style.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function getRootStyles(style: ContainerProps.Style | undefined) {
1414
borderRadius: style?.root?.borderRadius,
1515
borderWidth: style?.root?.borderWidth,
1616
boxShadow: style?.root?.boxShadow,
17+
color: style?.root?.color,
1718
};
1819
}
1920

0 commit comments

Comments
 (0)