Skip to content

Commit d0d0715

Browse files
Melissa Thompsoncastastrophe
authored andcommitted
feat(opacitycheckerboard): S2, small t-shirt size squares (#2610)
* feat(opacitycheckerboard): small t-shirt size squares * docs(opacitycheckerboard): chromatic coverage for t-shirt size
1 parent 9e0d991 commit d0d0715

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

components/opacitycheckerboard/index.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ permissions and limitations under the License. */
1515
--spectrum-opacity-checkerboard-square-light
1616
);
1717
--spectrum-opacity-checkerboard-size: var(
18-
--spectrum-opacity-checkerboard-square-size
18+
--spectrum-opacity-checkerboard-square-size-medium
1919
);
2020
--spectrum-opacity-checkerboard-position: left top;
2121
}
2222

23+
.spectrum-OpacityCheckerboard--sizeS {
24+
--spectrum-opacity-checkerboard-size: var(
25+
--spectrum-opacity-checkerboard-square-size-small
26+
);
27+
}
28+
2329
.spectrum-OpacityCheckerboard {
2430
background: repeating-conic-gradient(
2531
var(

components/opacitycheckerboard/stories/opacitycheckerboard.stories.js

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ export default {
1919
control: "text",
2020
description: "Value for <code>--mod-opacity-checkerboard-position</code>. Accepts any valid CSS background-position property value.",
2121
},
22+
size: {
23+
name: "Size",
24+
type: { name: "string", required: true },
25+
table: {
26+
type: { summary: "string" },
27+
category: "Component",
28+
},
29+
options: ["s", "m"],
30+
control: "select",
31+
},
2232
},
2333
args: {
2434
rootClass: "spectrum-OpacityCheckerboard",
@@ -36,21 +46,41 @@ export default {
3646
(Story, context) => html`<div style=${styleMap({ inlineSize: "100px", blockSize: "100px" })}>${Story(context)}</div>`
3747
],
3848
};
39-
export const Default = Template.bind({});
40-
Default.args = {
41-
customStyles: {
42-
"inline-size": "100%",
43-
"block-size": "100%"
44-
}
45-
};
4649

47-
export const CheckerboardPosition = Template.bind({});
50+
const CheckerboardDefault = (args) => html`
51+
${window.isChromatic() ? html`
52+
${Template({
53+
...args,
54+
customStyles: {
55+
"inline-size": "100%",
56+
"block-size": "100%"
57+
}
58+
})}
59+
<br>
60+
${Template({
61+
...args,
62+
customStyles: {
63+
"inline-size": "100%",
64+
"block-size": "100%"
65+
},
66+
size: "s",
67+
})}
68+
` : Template({
69+
...args,
70+
customStyles: {
71+
"inline-size": "100%",
72+
"block-size": "100%"
73+
}
74+
})}
75+
`;
76+
77+
78+
export const Default = CheckerboardDefault.bind({});
79+
Default.args = {};
80+
81+
export const CheckerboardPosition = CheckerboardDefault.bind({});
4882
CheckerboardPosition.args = {
4983
backgroundPosition: "center center",
50-
customStyles: {
51-
"inline-size": "100%",
52-
"block-size": "100%"
53-
}
5484
};
5585
CheckerboardPosition.parameters = {
5686
docs: {

components/opacitycheckerboard/stories/template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ export const Template = ({
1212
customStyles = {},
1313
id,
1414
content = [],
15+
size,
1516
role,
1617
}) => {
1718
return html`
1819
<div
1920
class=${classMap({
2021
[rootClass]: true,
22+
[`${rootClass}--size${size?.toUpperCase()}`]: typeof size !== "undefined",
2123
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
2224
})}
2325
style=${ifDefined(styleMap({

0 commit comments

Comments
 (0)