Skip to content

Commit 6133780

Browse files
committed
feat: add examples to development page
1 parent c5fc3d1 commit 6133780

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-usage-bar",
33
"version": "1.2.1",
44
"description": "Usage bar, graphic component for React",
5-
"main": "dist/main.js",
5+
"main": "dist/main.mjs",
66
"types": "dist/main.d.ts",
77
"files": [
88
"dist"
@@ -15,7 +15,7 @@
1515
"url": "https://github.com/ChrisUser/react-usage-bar.git"
1616
},
1717
"scripts": {
18-
"dev": "vite",
18+
"start": "vite",
1919
"build": "tsc --p ./tsconfig-build.json && vite build",
2020
"test": "react-scripts test",
2121
"prepublishOnly": "yarn build",

src/main.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,48 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom/client'
3+
import UsageBar from '../lib/UsageBar'
34

45
const App = () => {
5-
return <div>ok</div>
6+
const itemsToDisplay = [
7+
{
8+
name: 'UI',
9+
value: 10,
10+
color: '#000000'
11+
},
12+
{
13+
name: 'Photos',
14+
value: 30
15+
},
16+
{
17+
name: 'Videos',
18+
value: 15
19+
},
20+
{
21+
name: 'System Data',
22+
value: 33
23+
},
24+
{
25+
name: 'Other',
26+
value: 8
27+
}
28+
]
29+
30+
return (
31+
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', gap: 32, width: '100%', marginTop: 24 }}>
32+
<div style={{ padding: '24px 0', width: '60%' }}>
33+
<UsageBar showFallbackColors items={itemsToDisplay} total={100} />
34+
</div>
35+
<div style={{ padding: '24px 0', width: '60%' }}>
36+
<UsageBar showFallbackColors compactLayout items={itemsToDisplay} total={100} />
37+
</div>
38+
<div style={{ padding: '24px 0', width: '60%' }}>
39+
<UsageBar showFallbackColors compactLayout showLabels={false} items={itemsToDisplay} total={100} />
40+
</div>
41+
<div style={{ padding: '24px 0', width: '60%' }}>
42+
<UsageBar darkMode showFallbackColors compactLayout showLabels={false} items={itemsToDisplay} total={100} />
43+
</div>
44+
</div>
45+
)
646
}
747

848
ReactDOM.createRoot(document.getElementById('root')!).render(

0 commit comments

Comments
 (0)