Skip to content

Commit 3871411

Browse files
minor changes
1 parent 447f313 commit 3871411

3 files changed

Lines changed: 105 additions & 19 deletions

File tree

@codexteam/ui/README.md

Lines changed: 103 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,136 @@ The Design System forged in the fires of open-source development
44

55
Demo: https://cdx-ui.vercel.app/
66

7-
- [ ] Make tree-shaking work
7+
- [x] Make tree-shaking work
88
- [ ] Test Web/React/Native implementations
99
- [ ] Think about i18n
1010

11-
## Access Vue components
11+
## Installation
1212

13-
```ts
14-
import { Button, Input, Heading } from '@codexteam/ui/vue';
13+
```bash
14+
npm install @codexteam/ui
15+
# or
16+
yarn add @codexteam/ui
1517
```
1618

19+
## Quick Start
20+
21+
### 1. Import Base Styles (Required)
22+
23+
```typescript
24+
// main.ts
25+
import '@codexteam/ui/styles';
26+
```
27+
28+
### 2. Import Themes (Tree-shakeable)
29+
30+
Import only the themes you need - others will NOT be included in the bundle:
31+
32+
```typescript
33+
import '@codexteam/ui/styles/themes/pure';
34+
import '@codexteam/ui/styles/themes/grass';
35+
```
36+
37+
**Available themes:** `graphite`, `crimson`, `red`, `violet`, `grass`, `amber`, `pure`, `sky`
38+
39+
### 3. Import Components (Tree-shakeable)
40+
41+
```typescript
42+
import { Button, Avatar, Heading } from '@codexteam/ui/vue';
43+
```
44+
45+
### 4. Apply Theme in Template
46+
47+
```vue
48+
<template>
49+
<div color-scheme="light" theme-accent="pure" theme-base="grass">
50+
<Button>Click me</Button>
51+
</div>
52+
</template>
53+
```
54+
55+
## Complete Example
56+
57+
**main.ts:**
58+
```typescript
59+
import { createApp } from 'vue';
60+
import App from './App.vue';
61+
62+
// Base styles (required)
63+
import '@codexteam/ui/styles';
64+
65+
// Themes (import only what you need)
66+
import '@codexteam/ui/styles/themes/pure';
67+
import '@codexteam/ui/styles/themes/grass';
68+
69+
createApp(App).mount('#app');
70+
```
71+
72+
**App.vue:**
1773
```vue
18-
<Heading :level="2">
19-
CodeX UI showcase
20-
</Heading>
21-
<Button text="Button text" />
22-
<Input text="Input text" />
74+
<script setup lang="ts">
75+
import { Button, Heading, Input } from '@codexteam/ui/vue';
76+
</script>
77+
78+
<template>
79+
<div color-scheme="light" theme-accent="pure" theme-base="grass">
80+
<Heading :level="2">CodeX UI showcase</Heading>
81+
<Button>Button text</Button>
82+
<Input placeholder="Input text" />
83+
</div>
84+
</template>
2385
```
2486

2587
## Types for Vue Components
2688

2789
Add the following "path" to the "tsconfig.json"
2890

29-
```
91+
```json
3092
{
3193
"compilerOptions": {
3294
"paths": {
33-
"@codexteam/ui/vue": ["../@codexteam/ui/dist/types/vue/index.d.ts"],
95+
"@codexteam/ui/vue": ["../@codexteam/ui/dist/types/vue/index.d.ts"]
3496
}
35-
},
97+
}
3698
}
37-
3899
```
39100

40101
## Build Design System
41102
Build the design system to be able to use the @codexteam/ui/styles import
42103

43-
```
104+
```bash
44105
yarn build
45106
```
46107

47-
## Access CSS variables
108+
## Custom Theming
109+
110+
If you don't want to use built-in themes, define your own CSS variables:
111+
112+
```css
113+
:root {
114+
/* Base colors */
115+
--base--bg-primary: #ffffff;
116+
--base--bg-secondary: #f5f5f5;
117+
--base--bg-secondary-hover: #eeeeee;
118+
--base--border: #e0e0e0;
119+
--base--text: #333333;
120+
--base--text-secondary: #666666;
121+
--base--solid: #000000;
122+
--base--text-solid-foreground: #ffffff;
123+
124+
/* Accent colors */
125+
--accent--solid: #2196f3;
126+
--accent--solid-hover: #1976d2;
127+
--accent--bg-secondary: #e3f2fd;
128+
--accent--text-solid-foreground: #ffffff;
129+
}
130+
```
131+
132+
## Access CSS Variables
48133

49-
1. Import `@codexteam/ui/styles` somewhere in App
50-
2. Use variable in CSS, e.g `var(--ui-color)`
134+
1. Import `@codexteam/ui/styles` in your app
135+
2. Import themes you need (e.g., `@codexteam/ui/styles/themes/pure`)
136+
3. Use variables in CSS: `var(--base--text)`, `var(--accent--solid)`
51137

52138
## Using Typography
53139

@codexteam/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codexteam/ui",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"type": "module",
55
"sideEffects": [
66
"*.css",

@codexteam/ui/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
12
import { resolve } from 'path';
23
import { defineConfig } from 'vite';
34
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
@@ -74,7 +75,6 @@ export default defineConfig({
7475
},
7576
resolve: {
7677
alias: {
77-
// eslint-disable-next-line @typescript-eslint/naming-convention
7878
'@/': '/src/',
7979
},
8080
},

0 commit comments

Comments
 (0)