diff options
author | Eric Bailey <git@esb.lol> | 2024-01-08 19:43:56 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 19:43:56 -0600 |
commit | a5b474895a27bb36381cca6a580dc19e4c4b10c2 (patch) | |
tree | 8540478dcd85cf095de50b8a8076a86a1ba28369 /src/alf/README.md | |
parent | 0ee0554b8632a9d32fa36ffa9fde8d719ab1527e (diff) | |
download | voidsky-a5b474895a27bb36381cca6a580dc19e4c4b10c2.tar.zst |
Application Layout Framework (#1732)
* Initial library setup * Add docblocks * Some cleanup * New storybook * Playing around * Remove silly test, use for...in * Memo * Memo * Add hooks example * Tweak colors, bit of cleanup * Improve macro handling * Add some more examples * Rename for better diff * Cleanup * Add nested context example * Add todo * Less break more perf * Buttons, you get the idea * Fix test * Remove temp colors * Add a few more common macros * Docs * Perf improvements * Alf go brrrr * Update breakpoint handling * I think it'll work * Better naming, better code * Fix typo * Some renaming * More complete pass at Tailwind naming * Build out storybook * Playing around with curves * Revert "Playing around with curves" This reverts commit 6b0e0e5c9d842a2d9af31b53affe2f6291c3fa0d. * Smooth brain * Remove outdated docs * Some docs, fix line-height values, export tokens
Diffstat (limited to 'src/alf/README.md')
-rw-r--r-- | src/alf/README.md | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/alf/README.md b/src/alf/README.md new file mode 100644 index 000000000..aa31bcf98 --- /dev/null +++ b/src/alf/README.md @@ -0,0 +1,56 @@ +# Application Layout Framework (ALF) + +A set of UI primitives and components. + +## Usage + +Naming conventions follow Tailwind — delimited with a `_` instead of `-` to +enable object access — with a couple exceptions: + +**Spacing** + +Uses "t-shirt" sizes `xxs`, `xs`, `sm`, `md`, `lg`, `xl` and `xxl` instead of +increments of 4px. We only use a few common spacings, and otherwise typically +rely on many one-off values. + +**Text Size** + +Uses "t-shirt" sizes `xxs`, `xs`, `sm`, `md`, `lg`, `xl` and `xxl` to match our +type scale. + +**Line Height** + +The text size atoms also apply a line-height with the same value as the size, +for a 1:1 ratio. `tight` and `normal` are retained for use in the few places +where we need leading. + +### Atoms + +An (mostly-complete) set of style definitions that match Tailwind CSS selectors. +These are static and reused throughout the app. + +```tsx +import { atoms } from '#/alf' + +<View style={[atoms.flex_row]} /> +``` + +### Theme + +Any values that rely on the theme, namely colors. + +```tsx +const t = useTheme() + +<View style={[atoms.flex_row, t.atoms.bg]} /> +``` + +### Breakpoints + +```tsx +const b = useBreakpoints() + +if (b.gtMobile) { + // render tablet or desktop UI +} +``` |