Skip to content

Commit f819213

Browse files
Melissa Thompsonrise-erpelding
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 a0ebcbb commit f819213

File tree

3 files changed

+67
-28
lines changed

3 files changed

+67
-28
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: 41 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",
@@ -37,21 +47,40 @@ export default {
3747
],
3848
};
3949

40-
export const Default = Template.bind({});
41-
Default.args = {
42-
customStyles: {
43-
"inline-size": "100%",
44-
"block-size": "100%"
45-
}
46-
};
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 = {};
4780

48-
export const CheckerboardPosition = Template.bind({});
81+
export const CheckerboardPosition = CheckerboardDefault.bind({});
4982
CheckerboardPosition.args = {
5083
backgroundPosition: "center center",
51-
customStyles: {
52-
"inline-size": "100%",
53-
"block-size": "100%"
54-
}
5584
};
5685
CheckerboardPosition.parameters = {
5786
docs: {

components/opacitycheckerboard/stories/template.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ export const Template = ({
1212
customStyles = {},
1313
id,
1414
content = [],
15+
size,
1516
role,
16-
}) => html`
17-
<div
18-
class=${classMap({
19-
[rootClass]: true,
20-
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
21-
})}
22-
style=${ifDefined(styleMap({
23-
"--mod-opacity-checkerboard-position": backgroundPosition,
24-
...customStyles,
25-
}))}
26-
role=${ifDefined(role)}
27-
id=${ifDefined(id)}
28-
>
29-
${content}
30-
</div>`;
17+
}) => {
18+
return html`
19+
<div
20+
class=${classMap({
21+
[rootClass]: true,
22+
[`${rootClass}--size${size?.toUpperCase()}`]: typeof size !== "undefined",
23+
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
24+
})}
25+
style=${ifDefined(styleMap({
26+
"--mod-opacity-checkerboard-position": backgroundPosition,
27+
...customStyles,
28+
}))}
29+
role=${ifDefined(role)}
30+
id=${ifDefined(id)}
31+
>
32+
${content}
33+
</div>`;
34+
};

0 commit comments

Comments
 (0)