Skip to content

Commit 9168444

Browse files
committed
fix: divider styling, remove chat component context
1 parent 291d34c commit 9168444

File tree

7 files changed

+11
-33
lines changed

7 files changed

+11
-33
lines changed

src/item-card/__tests__/__snapshots__/styles.test.tsx.snap

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,23 @@ exports[`getContentStyles handles all possible style configurations 3`] = `
2323

2424
exports[`getFooterStyles handles all possible style configurations 1`] = `
2525
{
26-
"borderColor": undefined,
27-
"borderWidth": undefined,
2826
"paddingBlock": undefined,
2927
"paddingInline": undefined,
3028
}
3129
`;
3230

3331
exports[`getFooterStyles handles all possible style configurations 2`] = `
3432
{
35-
"borderColor": undefined,
36-
"borderWidth": undefined,
3733
"paddingBlock": undefined,
3834
"paddingInline": undefined,
3935
}
4036
`;
4137

4238
exports[`getFooterStyles handles all possible style configurations 3`] = `
4339
{
44-
"borderColor": "#e0e0e0",
45-
"borderWidth": "1px",
40+
"borderBlockStartColor": "#e0e0e0",
41+
"borderBlockStartStyle": "solid",
42+
"borderBlockStartWidth": "1px",
4643
"paddingBlock": "12px",
4744
"paddingInline": "20px",
4845
}

src/item-card/interfaces.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface BaseItemCardProps extends BaseComponentProps {
3737
children?: React.ReactNode;
3838

3939
/**
40-
* Displays an icon next to the content. You can use the `iconPosition` and `iconVerticalAlignment` properties to position the icon.
40+
* Displays an icon next to the content.
4141
*/
4242
iconName?: IconProps.Name;
4343

@@ -118,9 +118,6 @@ export interface ItemCardProps extends BaseItemCardProps {
118118
}
119119

120120
export namespace ItemCardProps {
121-
export type IconPosition = 'left' | 'right';
122-
export type IconVerticalAlignment = 'top' | 'center';
123-
124121
export interface Style {
125122
root?: {
126123
background?: string;

src/item-card/style.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ export function getFooterStyles(style: ItemCardProps.Style | undefined) {
4646
return {};
4747
}
4848

49+
const hasDivider = style?.footer?.divider?.borderColor || style?.footer?.divider?.borderWidth;
50+
4951
return {
50-
borderColor: style?.footer?.divider?.borderColor,
51-
borderWidth: style?.footer?.divider?.borderWidth,
52+
...(hasDivider && { borderBlockStartStyle: 'solid' as const }),
53+
...(style?.footer?.divider?.borderColor && { borderBlockStartColor: style.footer.divider.borderColor }),
54+
...(style?.footer?.divider?.borderWidth && { borderBlockStartWidth: style.footer.divider.borderWidth }),
5255
paddingBlock: style?.footer?.root?.paddingBlock,
5356
paddingInline: style?.footer?.root?.paddingInline,
5457
};

src/test-utils/dom/item-card/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export default class ItemCardWrapper extends ComponentWrapper<HTMLDivElement> {
1818
/**
1919
* Finds the content slot of the card.
2020
*/
21-
findContent(): ElementWrapper {
21+
findContent(): ElementWrapper | null {
2222
return this.findByClassName(styles.body)!;
2323
}
2424

2525
/**
2626
* Finds the description slot of the card.
2727
*/
28-
findDescription(): ElementWrapper {
28+
findDescription(): ElementWrapper | null {
2929
return this.findByClassName(styles.description)!;
3030
}
3131

style-dictionary/utils/contexts.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,3 @@ export const createAppLayoutToolbarContext = (tokens: TokenCategory<string, Glob
7575
tokens,
7676
};
7777
};
78-
79-
export const createChatComponentsContext = (tokens: TokenCategory<string, GlobalValue | ModeValue>) => {
80-
return {
81-
id: 'chat-components',
82-
selector: '.awsui-context-chat-components',
83-
tokens,
84-
};
85-
};

style-dictionary/visual-refresh/contexts/chat-components.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

style-dictionary/visual-refresh/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ThemeBuilder } from '@cloudscape-design/theming-build';
55
import {
66
createAlertContext,
77
createAppLayoutToolbarContext,
8-
createChatComponentsContext,
98
createCompactTableContext,
109
createFlashbarContext,
1110
createFlashbarWarningContext,
@@ -53,7 +52,6 @@ export async function buildVisualRefresh(builder: ThemeBuilder) {
5352
builder.addContext(createAlertContext((await import('./contexts/alert.js')).tokens));
5453
builder.addContext(createHeaderAlertContext((await import('./contexts/header-alert.js')).tokens));
5554
builder.addContext(createAppLayoutToolbarContext((await import('./contexts/app-layout-toolbar.js')).tokens));
56-
builder.addContext(createChatComponentsContext((await import('./contexts/chat-components.js')).tokens));
5755

5856
return builder.build();
5957
}

0 commit comments

Comments
 (0)