Skip to content

Instantly share code, notes, and snippets.

@WoLfulus
Last active May 18, 2023 19:00
Show Gist options
  • Save WoLfulus/6a2a2f762794ced3b0bc286836d5476c to your computer and use it in GitHub Desktop.
Save WoLfulus/6a2a2f762794ced3b0bc286836d5476c to your computer and use it in GitHub Desktop.
naci.js evolution (syntax)
// --------------------------------------------------------
// v1
$button: component(
name("Button"),
type("button"),
props(
prop(size, (default large)),
),
);
@include stylesheet($button) {
@apply py-1 px-2;
@include when(size is large) {
@apply py-4 px-6;
}
}
// --------------------------------------------------------
// v2
$button: definition(Button, (
element: button,
variants: (
size: options(default large)
)
));
@include styles($button) {
@apply py-1 px-2;
@include variants(size is large) {
@apply py-4 px-6;
}
}
@include export($button);
// --------------------------------------------------------
// v3
@include component(Button, (
element: button,
variants: (
size: options(default large)
)
)) {
@apply py-1 px-2;
@include variants(size is large) {
@apply py-4 px-6;
}
}
// --------------------------------------------------------
// v4 (now)
@include component(Button) {
@include element(button);
@include variants {
@include new(size, default large);
}
@include stylesheet {
@apply py-1 px-2;
@include variant(size is large) {
@apply py-4 px-6;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment