Skip to content

Commit 75dba9b

Browse files
authored
refactor(tile-group): add review suggestions (#8828)
**Related Issue:** #8806 ## Summary This is a follow-up for #8806, addressing comments in the review. No changes to functionality. --------- Co-authored-by: Erik Harper <eriklharper@pm.me>
1 parent ed3b352 commit 75dba9b

File tree

7 files changed

+16
-22
lines changed

7 files changed

+16
-22
lines changed

packages/calcite-components/src/components.d.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ import { TableMessages } from "./components/table/assets/table/t9n";
8484
import { TableCellMessages } from "./components/table-cell/assets/table-cell/t9n";
8585
import { TableHeaderMessages } from "./components/table-header/assets/table-header/t9n";
8686
import { TextAreaMessages } from "./components/text-area/assets/text-area/t9n";
87-
import { TileGroupLayout } from "./components/tile-group/interfaces";
8887
import { TileSelectType } from "./components/tile-select/interfaces";
8988
import { TileSelectGroupLayout } from "./components/tile-select-group/interfaces";
9089
import { TipMessages } from "./components/tip/assets/tip/t9n";
@@ -171,7 +170,6 @@ export { TableMessages } from "./components/table/assets/table/t9n";
171170
export { TableCellMessages } from "./components/table-cell/assets/table-cell/t9n";
172171
export { TableHeaderMessages } from "./components/table-header/assets/table-header/t9n";
173172
export { TextAreaMessages } from "./components/text-area/assets/text-area/t9n";
174-
export { TileGroupLayout } from "./components/tile-group/interfaces";
175173
export { TileSelectType } from "./components/tile-select/interfaces";
176174
export { TileSelectGroupLayout } from "./components/tile-select-group/interfaces";
177175
export { TipMessages } from "./components/tip/assets/tip/t9n";
@@ -4995,7 +4993,7 @@ export namespace Components {
49954993
/**
49964994
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
49974995
*/
4998-
"layout": TileGroupLayout;
4996+
"layout": Exclude<Layout, "grid">;
49994997
/**
50004998
* Specifies the size of the component.
50014999
*/
@@ -12521,7 +12519,7 @@ declare namespace LocalJSX {
1252112519
/**
1252212520
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
1252312521
*/
12524-
"layout"?: TileGroupLayout;
12522+
"layout"?: Exclude<Layout, "grid">;
1252512523
/**
1252612524
* Specifies the size of the component.
1252712525
*/

packages/calcite-components/src/components/tile-group/interfaces.ts

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const CSS = {
2-
tileGroup: "tile-group",
2+
container: "container",
33
};

packages/calcite-components/src/components/tile-group/tile-group.scss

+8-11
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,32 @@
22
box-sizing: border-box;
33
display: inline-block;
44

5-
.tile-group {
6-
display: grid;
7-
grid-auto-rows: minmax(auto, 1fr);
8-
}
9-
105
::slotted(calcite-tile) {
116
margin-block-end: var(--calcite-spacing-px);
127
margin-inline-end: var(--calcite-spacing-px);
138
}
149
}
15-
10+
.container {
11+
display: grid;
12+
grid-auto-rows: minmax(auto, 1fr);
13+
}
1614
:host([scale="s"]) {
17-
.tile-group {
15+
.container {
1816
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
1917
}
2018
}
2119
:host([scale="m"]) {
22-
.tile-group {
20+
.container {
2321
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
2422
}
2523
}
2624
:host([scale="l"]) {
27-
.tile-group {
25+
.container {
2826
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
2927
}
3028
}
31-
3229
:host([layout="vertical"]) {
33-
.tile-group {
30+
.container {
3431
display: flex;
3532
flex-direction: column;
3633
}

packages/calcite-components/src/components/tile-group/tile-group.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
...storyFilters(),
1313
};
1414

15-
export const playground = (): string => html`
15+
export const simple = (): string => html`
1616
<calcite-tile-group
1717
dir="${select("dir", ["ltr", "rtl"], "ltr", "Tile Group")}"
1818
${boolean("disabled", false)}

packages/calcite-components/src/components/tile-group/tile-group.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import {
66
InteractiveContainer,
77
updateHostInteraction,
88
} from "../../utils/interactive";
9-
import { TileGroupLayout } from "./interfaces";
10-
import { Scale } from "../interfaces";
9+
import { Layout, Scale } from "../interfaces";
1110
import { CSS } from "./resources";
1211

1312
/**
@@ -33,7 +32,7 @@ export class TileGroup implements InteractiveComponent {
3332
*
3433
* Use `"horizontal"` for rows, and `"vertical"` for a single column.
3534
*/
36-
@Prop({ reflect: true }) layout: TileGroupLayout = "horizontal";
35+
@Prop({ reflect: true }) layout: Exclude<Layout, "grid"> = "horizontal";
3736

3837
/**
3938
* Specifies the size of the component.
@@ -85,7 +84,7 @@ export class TileGroup implements InteractiveComponent {
8584
render(): VNode {
8685
return (
8786
<InteractiveContainer disabled={this.disabled}>
88-
<div class={CSS.tileGroup}>
87+
<div class={CSS.container}>
8988
<slot onSlotchange={this.updateTiles} />
9089
</div>
9190
</InteractiveContainer>

packages/calcite-components/stencil.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const create: () => Config = () => ({
7878
{ components: ["calcite-tab", "calcite-tab-title", "calcite-tab-nav", "calcite-tabs"] },
7979
{ components: ["calcite-text-area"] },
8080
{ components: ["calcite-tile"] },
81+
{ components: ["calcite-tile-group"] },
8182
{ components: ["calcite-tile-select-group", "calcite-tile-select"] },
8283
{ components: ["calcite-tip", "calcite-tip-group", "calcite-tip-manager"] },
8384
{ components: ["calcite-tooltip"] },

0 commit comments

Comments
 (0)