about summary refs log tree commit diff
path: root/src/alf/README.md
blob: aa31bcf988a5a2f961e1a5ee0c9415643495e2a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
}
```