Skip to content

feat(opacitycheckerboard): small t-shirt size squares #2610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion components/opacitycheckerboard/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ permissions and limitations under the License. */
--spectrum-opacity-checkerboard-square-light
);
--spectrum-opacity-checkerboard-size: var(
--spectrum-opacity-checkerboard-square-size
--spectrum-opacity-checkerboard-square-size-medium
);
--spectrum-opacity-checkerboard-position: left top;
}

.spectrum-OpacityCheckerboard--sizeS {
--spectrum-opacity-checkerboard-size: var(
--spectrum-opacity-checkerboard-square-size-small
);
}

.spectrum-OpacityCheckerboard {
background: repeating-conic-gradient(
var(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ export default {
control: "text",
description: "Value for <code>--mod-opacity-checkerboard-position</code>. Accepts any valid CSS background-position property value.",
},
size: {
name: "Size",
type: { name: "string", required: true },
table: {
type: { summary: "string" },
category: "Component",
},
options: ["s", "m"],
control: "select",
},
},
args: {
rootClass: "spectrum-OpacityCheckerboard",
Expand All @@ -36,21 +46,41 @@ export default {
(Story, context) => html`<div style=${styleMap({ inlineSize: "100px", blockSize: "100px" })}>${Story(context)}</div>`
],
};
export const Default = Template.bind({});
Default.args = {
customStyles: {
"inline-size": "100%",
"block-size": "100%"
}
};

export const CheckerboardPosition = Template.bind({});
const CheckerboardDefault = (args) => html`
${window.isChromatic() ? html`
${Template({
...args,
customStyles: {
"inline-size": "100%",
"block-size": "100%"
}
})}
<br>
${Template({
...args,
customStyles: {
"inline-size": "100%",
"block-size": "100%"
},
size: "s",
})}
` : Template({
...args,
customStyles: {
"inline-size": "100%",
"block-size": "100%"
}
})}
`;


export const Default = CheckerboardDefault.bind({});
Default.args = {};

export const CheckerboardPosition = CheckerboardDefault.bind({});
CheckerboardPosition.args = {
backgroundPosition: "center center",
customStyles: {
"inline-size": "100%",
"block-size": "100%"
}
};
CheckerboardPosition.parameters = {
docs: {
Expand Down
2 changes: 2 additions & 0 deletions components/opacitycheckerboard/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ export const Template = ({
customStyles = {},
id,
content = [],
size,
role,
}) => {
return html`
<div
class=${classMap({
[rootClass]: true,
[`${rootClass}--size${size?.toUpperCase()}`]: typeof size !== "undefined",
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
})}
style=${ifDefined(styleMap({
Expand Down