Created
October 25, 2021 20:39
-
-
Save jckw/880b53608d10e259652a77207e71143b to your computer and use it in GitHub Desktop.
Stitches Stack component for Figma-style positioning.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { styled } from "@stitches/react" | |
const Stack = styled("div", { | |
display: "flex", | |
variants: { | |
dir: { | |
col: { flexDirection: "column" }, | |
row: { flexDirection: "row" }, | |
}, | |
y: { | |
top: {}, | |
center: {}, | |
bottom: {}, | |
}, | |
x: { | |
left: {}, | |
center: {}, | |
right: {}, | |
}, | |
density: { | |
packed: {}, | |
spaceBetween: { | |
justifyContent: "space-between !important", | |
}, | |
}, | |
}, | |
compoundVariants: [ | |
{ dir: "col", y: "top", css: { justifyContent: "flex-start" } }, | |
{ dir: "col", y: "center", css: { justifyContent: "center" } }, | |
{ dir: "col", y: "bottom", css: { justifyContent: "flex-end" } }, | |
{ dir: "row", x: "left", css: { justifyContent: "flex-start" } }, | |
{ dir: "row", x: "center", css: { justifyContent: "center" } }, | |
{ dir: "row", x: "right", css: { justifyContent: "flex-end" } }, | |
{ dir: "col", x: "left", css: { alignItems: "flex-start" } }, | |
{ dir: "col", x: "center", css: { alignItems: "center" } }, | |
{ dir: "col", x: "right", css: { alignItems: "flex-end" } }, | |
{ dir: "row", y: "top", css: { alignItems: "flex-start" } }, | |
{ dir: "row", y: "center", css: { alignItems: "center" } }, | |
{ dir: "row", y: "bottom", css: { alignItems: "flex-end" } }, | |
], | |
}) | |
export default Stack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment