Skip to content

Commit b239f17

Browse files
Send UI User Guide v0
1 parent 47ee596 commit b239f17

File tree

5 files changed

+1767
-1595
lines changed

5 files changed

+1767
-1595
lines changed

packages/ui/README.md

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# /send UI
2+
3+
## User Guide v0
4+
5+
Send uses [Tamagui](https://tamagui.dev/) for styling and components across web and native platforms. Tamagui is a CSS-in-JS library that provides a set of primitives and components to build accessible design systems that work everywhere.
6+
7+
### Tamagui Components
8+
9+
Tamagui provides a variety of components that fit directly into its design ecosystem that help build on a greater scale, more quickly, at a greater scale.
10+
11+
<details><summary>Tamagui supports the following components:</summary>
12+
<ul>
13+
<li><a>View</a></li>
14+
<li><a>Stack</a></li>
15+
<li><a>XStack</a></li>
16+
<li><a>YStack</a></li>
17+
<li><a>ZStack</a></li>
18+
<li><a>H1- H6</a></li>
19+
<li><a>Paragraph</a></li>
20+
<li><a>Button</a></li>
21+
<li><a>Link</a></li>
22+
<li><a>Text</a></li>
23+
<li><a>SizeableText</a></li>
24+
<li><a>Input</a></li>
25+
<li><a>Card</a></li>
26+
<li><a>Avatar</a></li>
27+
<li><a>Badge</a></li>
28+
<li><a>Tooltip</a></li>
29+
<li><a>Checkbox</a></li>
30+
<li><a>Form</a></li>
31+
<li><a>Input & TextArea</a></li>
32+
<li><a>Label</a></li>
33+
<li><a>Progress</a></li>
34+
<li><a>Radio</a></li>
35+
<li><a>Select</a></li>
36+
<li><a>Slider</a></li>
37+
<li><a>Switch</a></li>
38+
<li><a>Toggle</a></li>
39+
<li><a>Dialog</a></li>
40+
<li><a>AlertDialog</a></li>
41+
<li><a>Popover</a></li>
42+
<li><a>Sheet</a></li>
43+
<li><a>Tooltip</a></li>
44+
<li><a>Toast</a></li>
45+
<li><a>Accordion</a></li>
46+
<li><a>Group</a></li>
47+
<li><a>Tabs</a></li>
48+
</ul>
49+
</details>
50+
<br>
51+
These components can be used to take full advantage of Send's tamagui UI integrations, including color themes, fonts, media queries and cross-platform support.
52+
53+
Of course, not all components will fit under this umbrella, and we will need ways to extend Tamagui defaults, but that we bridge can be crossed when we need it.
54+
55+
### Send Color Themes
56+
57+
One of the best features of using Tamagui's components, is their themability. Tamagui supports light and dark switching out of the box.
58+
59+
Send has compiled a set of color themes that will integrate directly into the imported Tamagui Components. To do that we have to start with a few concepts.
60+
61+
#### Rule 1: Colors 0-12
62+
63+
![send palettes](./assets/send_palettes.png 'Rule 1 Colors 0-12')
64+
Send UI takes a lot of inspiration from Radix UI. Send has sets of 12 colors for each light and dark theme.
65+
66+
**In the words of RadixUI:**
67+
68+
> There are 12 steps in each scale. Each step was designed for at least one specific use case.
69+
> This table is a simple overview of the most common use case for each step. However, there are many exceptions and caveats to factor in, which are covered in further detail below.
70+
71+
<table class="rt-Box rt-r-my-5" style="display: table; width: 100%; text-align: left; border-collapse: collapse;"><thead><tr><th class="rt-Box rt-r-px-4 rt-r-py-3" style="display: table-cell; width: 50%; border-bottom: 1px solid var(--gray-a3);"><p data-accent-color="gray" class="rt-Text rt-r-size-2 rt-r-weight-regular">Step</p></th><th class="rt-Box rt-r-px-4 rt-r-py-3" style="display: table-cell; border-bottom: 1px solid var(--gray-a3);"><p data-accent-color="gray" class="rt-Text rt-r-size-2 rt-r-weight-regular">Use Case</p></th></tr></thead><tbody><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">1</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">App background</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">2</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">Subtle background</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">3</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">UI element background</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">4</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">Hovered UI element background</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">5</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">Active / Selected UI element background</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">6</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">Subtle borders and separators</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">7</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">UI element border and focus rings</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">8</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">Hovered UI element border</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">9</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">Solid backgrounds</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">10</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">Hovered solid backgrounds</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">11</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: var(--gray-a2);"><p class="rt-Text rt-r-size-2">Low-contrast text</p></td></tr><tr><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">12</p></td><td class="rt-Box rt-r-px-4 rt-r-py-2" style="display: table-cell; border-bottom: 1px solid var(--gray-a3); background-color: transparent;"><p class="rt-Text rt-r-size-2">High-contrast text</p></td></tr></tbody></table>
72+
73+
As Send's UI Library matures, the color palettes will likely get closer and closer to these ideals, so it's a good place to anchor your understanding.
74+
75+
To use themes effectively, let's take a look at an example
76+
77+
Let's take a look at Send's `<Card>` component
78+
79+
This code:
80+
81+
```tsx
82+
<Card>
83+
<Card.Header>Send Header</Card.Header>
84+
Send Card Body
85+
<Card.Footer>Send Footer</Card.Footer>
86+
</Card>
87+
```
88+
89+
Produces this UI:
90+
91+
<div style="background-color: #081619; padding: 3rem; border-radius: 1rem;">
92+
<div style="color:white;background-color: #111f22;"><div>Send Header</div>Send Card Body<div>Send Footer</div></div></div>
93+
94+
Nothing special, however we have a few takeaways from this.
95+
96+
1. By default, the `<Card>` component softens it's background color, since mst likely, you will design a Card to stand out from the rest of the UI.
97+
2. The `<Card.Header>` and `<Card.Footer>` not only add padding, they also inherit the theme properties of the Card parent.
98+
99+
Let's see what happens when we add a theme to the Card.
100+
101+
```tsx
102+
<Card theme={'green_alt2'}>
103+
<Card.Header>Send Header</Card.Header>
104+
Send Card Body
105+
<Card.Footer>Send Footer</Card.Footer>
106+
</Card>
107+
```
108+
109+
<div style="background-color: #081619; padding: 3rem; border-radius: 1rem;">
110+
<div style="color:white;background-color: #12643F;color: #40FB50;"><div><div>Send Header</div></div>Send Card Body<div >Send Footer</div></div></div>
111+
112+
The Card now has a green background, and the text has also adapted this theme.
113+
114+
**SideNote:** You might notice this theme is pretty ugly. The design library is still in beta so there may be incomplete themes. This is one of those incomplete themes, put it works great as an example
115+
116+
Let's do another example, this time with a `<Button>`
117+
118+
Here's a default `<Button>`
119+
120+
```tsx
121+
<Button>
122+
<ButtonText>Send</ButtonText>
123+
</Button>
124+
```
125+
126+
<div style="background-color: #081619; padding: 3rem; border-radius: 1rem;">
127+
<button style="display: flex; align-items: center; flex-flow: row; flex-basis: auto; box-sizing: border-box; position: relative; min-height: 0px; min-width: 0px; flex-shrink: 0; padding-right: 18px; padding-left: 18px; height: 44px; border-top-left-radius: 16px; border-top-right-radius: 16px; border-bottom-right-radius: 16px; border-bottom-left-radius: 16px; justify-content: center; cursor: pointer; background-color: #111f22; border-color: transparent; border-width: 1px; border-style: solid;"><span style="color: white"><span>Send</span></span></button>
128+
</div>
129+
130+
Adding a few themes will produce these results:
131+
132+
```tsx
133+
<Button theme={'green'}>
134+
<ButtonText>Send</ButtonText>
135+
</Button>
136+
```
137+
138+
<div style="background-color: #081619; padding: 3rem; border-radius: 1rem;">
139+
<button style="display: flex; align-items: center; flex-flow: row; flex-basis: auto; box-sizing: border-box; position: relative; min-height: 0px; min-width: 0px; flex-shrink: 0; padding-right: 18px; padding-left: 18px; height: 44px; border-top-left-radius: 16px; border-top-right-radius: 16px; border-bottom-right-radius: 16px; border-bottom-left-radius: 16px; justify-content: center; cursor: pointer; background-color: #40FB50; border-color: transparent; border-width: 1px; border-style: solid;"><span style="color: black"><span>Send</span></span></button>
140+
</div>
141+
142+
```tsx
143+
<Button theme={'red'}>
144+
<ButtonText>Send</ButtonText>
145+
</Button>
146+
```
147+
148+
<div style="background-color: #081619; padding: 3rem; border-radius: 1rem;">
149+
<button style="display: flex; align-items: center; flex-flow: row; flex-basis: auto; box-sizing: border-box; position: relative; min-height: 0px; min-width: 0px; flex-shrink: 0; padding-right: 18px; padding-left: 18px; height: 44px; border-top-left-radius: 16px; border-top-right-radius: 16px; border-bottom-right-radius: 16px; border-bottom-left-radius: 16px; justify-content: center; cursor: pointer; background-color: #40FB50; border-color: transparent; border-width: 1px; border-style: solid;"><span style="color: hsl(357, 34.4%, 12.0%)"><span>Send</span></span></button>
150+
</div>
151+
152+
```tsx
153+
<Button theme={'ghost'} variant={'outlined'}>
154+
<ButtonText>Send</ButtonText>
155+
</Button>
156+
```
157+
158+
This is a great example of how themes can be used to create a consistent experience across the UI.

packages/ui/assets/send_palettes.png

148 KB
Loading

packages/ui/src/themes/masks.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const masks = {
8383
backgroundHover: plain.backgroundTransparent,
8484
color: plain.borderColor,
8585
colorPress: plain.background,
86-
borderColor: plain.borderColor,
8786
}
8887
}),
8988
}

packages/ui/src/themes/palettes.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const palettes = (() => {
1616
brandColors.white,
1717
brandColors.alabaster,
1818
brandColors.darkAlabaster,
19-
brandColors.silverChalice,
19+
brandColors.lightGrayTextField,
2020
brandColors.white,
2121
brandColors.white,
2222
brandColors.white,

0 commit comments

Comments
 (0)