Skip to content

Commit

Permalink
Feat: divide & decoration design tokens (#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwatts777 authored Dec 4, 2023
1 parent 30d295e commit ab6f530
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/plugin/src/tailwind/tokens/borders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export const borders = (): CssClasses => {
// Color Pairings
// Example: .border-primary-50-900-token | .border-primary-900-50-token
settings.colorPairings.forEach((p) => {
// Standard Border
classes[`.border-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.light}))` };
classes[`.dark .border-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.dark}))` };
// Divide Border
classes[`.divide-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.light}))` };
classes[`.dark .divide-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.dark}))` };
});
});
return classes;
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin/src/tailwind/tokens/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ export const text = (): CssClasses => {
// Color Pairings
// Example: .text-primary-50-900-token | .text-primary-900-50-token
settings.colorPairings.forEach((p) => {
// Text
classes[`.text-${n}-${p.light}-${p.dark}-token`] = { color: `rgb(var(--color-${n}-${p.light}))` };
classes[`.dark .text-${n}-${p.light}-${p.dark}-token`] = { color: `rgb(var(--color-${n}-${p.dark}))` };
// Text Decoration
classes[`.decoration-${n}-${p.light}-${p.dark}-token`] = { 'text-decoration-color': `rgb(var(--color-${n}-${p.light}))` };
classes[`.dark .decoration-${n}-${p.light}-${p.dark}-token`] = { 'text-decoration-color': `rgb(var(--color-${n}-${p.dark}))` };
});
});
return classes;
Expand Down
2 changes: 1 addition & 1 deletion packages/skeleton/src/lib/utilities/Drawer/Drawer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
// Props (transition)
/** Set the transition duration in milliseconds. */
export let duration: number = 200;
export let duration = 200;
/**
* Enable/Disable transitions
* @type {boolean}
Expand Down
27 changes: 27 additions & 0 deletions sites/skeleton.dev/src/routes/(inner)/docs/tokens/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@
['<code class="code">.text-[color]-[pairings]-token</code>', `${vColorsAll}<br>${vPairings}`, descPairings]
]
};
const tableTDecoration: TableSource = {
head: headings,
body: [['<code class="code">.decoration-[color]-[pairings]-token</code>', `${vColorsAll}<br>${vPairings}`, descPairings]]
};
const tableDivide: TableSource = {
head: headings,
// body: [['<code class="code">.divide-[color]-[pairings]-token</code>', `${vColorsAll}<br>${vPairings}`, descPairings + `\n` + ` <a class='anchor href='https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line' target="_blank">text-decoration-line</a>`]]
body: [
[
'<code class="code">.divide-[color]-[pairings]-token</code>',
`${vColorsAll}<br>${vPairings}`,
`\nImplements a <a class='anchor' href='https://tailwindcss.com/docs/text-decoration' target="_blank">text-decoration</a> color. ` +
descPairings
]
]
};
const tableMisc: TableSource = {
head: headings,
body: [
Expand Down Expand Up @@ -149,6 +165,12 @@
<h2 class="h2">Borders</h2>
<Table source={tableBorder} />
</section>
<!-- Divides -->
<section class="space-y-4">
<h2 class="h2">Divide</h2>
<p>Utility for controlling the border color between elements.</p>
<Table source={tableDivide} />
</section>
<!-- Fills -->
<section class="space-y-4">
<h2 class="h2">SVG Fill Color</h2>
Expand All @@ -165,6 +187,11 @@
<h2 class="h2">Text</h2>
<Table source={tableText} />
</section>
<!--Text Decoration-->
<section class="space-y-4">
<h2 class="h2">Text Decoration</h2>
<Table source={tableTDecoration} />
</section>
<!-- Accent -->
<section class="space-y-4">
<h2 class="h2">Accent</h2>
Expand Down

0 comments on commit ab6f530

Please sign in to comment.