-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor: Add spacing, typos and colors to theme #467
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a6d4613
refactor(tokens): simplify semantic token names
isaquebock 481957d
refactor(tailwind): update theme to use simplified CSS variable names
isaquebock 2fcf6ca
feat(tailwind): add semantic plugins for colors, texts and spacing
isaquebock 0a142c1
feat(package): add exports for semantic plugins
isaquebock 3804ef9
refactor(preset): update to use simplified CSS variable names
isaquebock 5d8aa67
docs: update README with new CSS variable names
isaquebock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /** | ||
| * Tailwind plugin to expose semantic colors at root level. | ||
| * | ||
| * This allows using classes like `text-muted` instead of `text-text-muted`. | ||
| * | ||
| * Usage in tailwind.config.js: | ||
| * ```javascript | ||
| * import { theme } from '@aziontech/theme/tailwind/tailwind-theme.js'; | ||
| * import semanticColors from '@aziontech/theme/tailwind/semantic-colors-plugin.js'; | ||
| * | ||
| * export default { | ||
| * theme, | ||
| * plugins: [semanticColors()], | ||
| * }; | ||
| * ``` | ||
| */ | ||
|
|
||
| // Lazy-require to avoid hard dependency for consumers | ||
| const plugin = (() => { | ||
| try { | ||
| return require('tailwindcss/plugin'); | ||
| } catch { | ||
| return (handler) => handler; | ||
| } | ||
| })(); | ||
|
|
||
| /** | ||
| * Generate semantic color utilities | ||
| * @returns {import('tailwindcss/plugin').Plugin} | ||
| */ | ||
| export const semanticColors = () => { | ||
| return plugin(({ addUtilities }) => { | ||
| const textColors = { | ||
| '.text-default': { color: 'var(--text-default)' }, | ||
| '.text-muted': { color: 'var(--text-muted)' }, | ||
| '.text-link': { color: 'var(--text-link)' }, | ||
| '.text-linkHover': { color: 'var(--text-linkHover)' }, | ||
| '.text-code': { color: 'var(--text-code)' }, | ||
| '.text-primary': { color: 'var(--text-primary)' }, | ||
| '.text-primaryHover': { color: 'var(--text-primaryHover)' }, | ||
| '.text-accent': { color: 'var(--text-accent)' }, | ||
| '.text-accentHover': { color: 'var(--text-accentHover)' }, | ||
| '.text-danger': { color: 'var(--text-danger)' }, | ||
| '.text-dangerHover': { color: 'var(--text-dangerHover)' }, | ||
| '.text-warning': { color: 'var(--text-warning)' }, | ||
| '.text-warningHover': { color: 'var(--text-warningHover)' }, | ||
| '.text-success': { color: 'var(--text-success)' }, | ||
| '.text-successHover': { color: 'var(--text-successHover)' }, | ||
| }; | ||
|
|
||
| const bgColors = { | ||
| '.bg-surfaceRaised': { 'background-color': 'var(--background-surfaceRaised)' }, | ||
| '.bg-surfaceOverlay': { 'background-color': 'var(--background-surfaceOverlay)' }, | ||
| '.bg-surface': { 'background-color': 'var(--background-surface)' }, | ||
| '.bg-canvas': { 'background-color': 'var(--background-canvas)' }, | ||
| '.bg-danger': { 'background-color': 'var(--background-danger)' }, | ||
| '.bg-dangerHover': { 'background-color': 'var(--background-dangerHover)' }, | ||
| '.bg-warning': { 'background-color': 'var(--background-warning)' }, | ||
| '.bg-warningHover': { 'background-color': 'var(--background-warningHover)' }, | ||
| '.bg-success': { 'background-color': 'var(--background-success)' }, | ||
| '.bg-successHover': { 'background-color': 'var(--background-successHover)' }, | ||
| '.bg-backdrop': { 'background-color': 'var(--background-backdrop)' }, | ||
| '.bg-primary': { 'background-color': 'var(--background-primary)' }, | ||
| '.bg-primaryHover': { 'background-color': 'var(--background-primaryHover)' }, | ||
| }; | ||
|
|
||
| const borderColors = { | ||
| '.border-default': { 'border-color': 'var(--border-default)' }, | ||
| '.border-strong': { 'border-color': 'var(--border-strong)' }, | ||
| '.border-subtle': { 'border-color': 'var(--border-subtle)' }, | ||
| '.border-warning': { 'border-color': 'var(--border-warning)' }, | ||
| '.border-warningHover': { 'border-color': 'var(--border-warningHover)' }, | ||
| '.border-success': { 'border-color': 'var(--border-success)' }, | ||
| '.border-successHover': { 'border-color': 'var(--border-successHover)' }, | ||
| '.border-danger': { 'border-color': 'var(--border-danger)' }, | ||
| '.border-dangerHover': { 'border-color': 'var(--border-dangerHover)' }, | ||
| '.border-primary': { 'border-color': 'var(--border-primary)' }, | ||
| '.border-primaryHover': { 'border-color': 'var(--border-primaryHover)' }, | ||
| '.border-accent': { 'border-color': 'var(--border-accent)' }, | ||
| '.border-accentHover': { 'border-color': 'var(--border-accentHover)' }, | ||
| }; | ||
|
|
||
| addUtilities(textColors, ['responsive', 'hover', 'dark']); | ||
| addUtilities(bgColors, ['responsive', 'hover', 'dark']); | ||
| addUtilities(borderColors, ['responsive', 'hover', 'dark']); | ||
| }); | ||
| }; | ||
|
|
||
| export default semanticColors; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /** | ||
| * Tailwind plugin to expose semantic spacing styles. | ||
| * | ||
| * This adds spacing components for container, padding, and gap utilities. | ||
| * | ||
| * Usage in tailwind.config.js: | ||
| * ```javascript | ||
| * import { theme } from '@aziontech/theme/tailwind/tailwind-theme.js'; | ||
| * import semanticSpacing from '@aziontech/theme/tailwind/semantic-spacing-plugin.js'; | ||
| * | ||
| * export default { | ||
| * theme, | ||
| * plugins: [semanticSpacing()], | ||
| * }; | ||
| * ``` | ||
| */ | ||
|
|
||
| // Lazy-require to avoid hard dependency for consumers | ||
| const plugin = (() => { | ||
| try { | ||
| return require('tailwindcss/plugin'); | ||
| } catch { | ||
| return (handler) => handler; | ||
| } | ||
| })(); | ||
|
|
||
| /** | ||
| * Generate semantic spacing style components | ||
| * @returns {import('tailwindcss/plugin').Plugin} | ||
| */ | ||
| export const semanticSpacing = () => { | ||
| return plugin(({ addComponents, theme }) => { | ||
| const spacing = { | ||
| // Container | ||
| '.max-container-width': { | ||
| maxWidth: '1280px', | ||
| }, | ||
| '.px-container': { | ||
| paddingLeft: '0px', | ||
| paddingRight: '0px', | ||
| }, | ||
| '.py-container': { | ||
| paddingTop: '48px', | ||
| paddingBottom: '48px', | ||
| }, | ||
|
|
||
| // Padding elements | ||
| '.p-elements-confortable': { | ||
| padding: '24px', | ||
| }, | ||
| '.p-elements-base': { | ||
| padding: '12px', | ||
| }, | ||
| '.p-elements-compact': { | ||
| padding: '6px', | ||
| }, | ||
|
|
||
| // Gap elements | ||
| '.gap-elements-confortable': { | ||
| gap: '24px', | ||
| }, | ||
| '.gap-elements-base': { | ||
| gap: '12px', | ||
| }, | ||
| '.gap-elements-compact': { | ||
| gap: '6px', | ||
| }, | ||
|
|
||
| // Gap sections | ||
| '.gap-sections': { | ||
| gap: '48px', | ||
| }, | ||
| }; | ||
|
|
||
| const responsiveSpacing = { | ||
| [`@media (max-width: ${theme('screens.md', '768px')})`]: { | ||
| '.max-container-width': { | ||
| maxWidth: '1024px', | ||
| }, | ||
| '.px-container': { | ||
| paddingLeft: '10px', | ||
| paddingRight: '10px', | ||
| }, | ||
| '.py-container': { | ||
| paddingTop: '32px', | ||
| paddingBottom: '32px', | ||
| }, | ||
| '.p-elements-confortable': { | ||
| padding: '16px', | ||
| }, | ||
| '.p-elements-base': { | ||
| padding: '8px', | ||
| }, | ||
| '.p-elements-compact': { | ||
| padding: '5px', | ||
| }, | ||
| '.gap-elements-confortable': { | ||
| gap: '16px', | ||
| }, | ||
| '.gap-elements-base': { | ||
| gap: '8px', | ||
| }, | ||
| '.gap-elements-compact': { | ||
| gap: '6px', | ||
| }, | ||
| '.gap-sections': { | ||
| gap: '40px', | ||
| }, | ||
| }, | ||
| [`@media (max-width: ${theme('screens.sm', '640px')})`]: { | ||
| '.max-container-width': { | ||
| maxWidth: '414px', | ||
| }, | ||
| '.px-container': { | ||
| paddingLeft: '4px', | ||
| paddingRight: '4px', | ||
| }, | ||
| '.py-container': { | ||
| paddingTop: '16px', | ||
| paddingBottom: '16px', | ||
| }, | ||
| '.p-elements-confortable': { | ||
| padding: '8px', | ||
| }, | ||
| '.p-elements-base': { | ||
| padding: '6px', | ||
| }, | ||
| '.p-elements-compact': { | ||
| padding: '4px', | ||
| }, | ||
| '.gap-elements-confortable': { | ||
| gap: '8px', | ||
| }, | ||
| '.gap-elements-base': { | ||
| gap: '6px', | ||
| }, | ||
| '.gap-elements-compact': { | ||
| gap: '4px', | ||
| }, | ||
| '.gap-sections': { | ||
| gap: '20px', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| addComponents(spacing); | ||
| addComponents(responsiveSpacing); | ||
| }); | ||
| }; | ||
|
|
||
| export default semanticSpacing; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.