-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add react-vant + Rsbuild demo (#124)
- Loading branch information
1 parent
f5fcf98
commit 358a768
Showing
11 changed files
with
201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Local | ||
.DS_Store | ||
*.local | ||
*.log* | ||
|
||
# Dist | ||
node_modules | ||
dist/ | ||
|
||
# IDE | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Rsbuild Project | ||
|
||
## Setup | ||
|
||
Install the dependencies: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
## Get Started | ||
|
||
Start the dev server: | ||
|
||
```bash | ||
pnpm dev | ||
``` | ||
|
||
Build the app for production: | ||
|
||
```bash | ||
pnpm build | ||
``` | ||
|
||
Preview the production build locally: | ||
|
||
```bash | ||
pnpm preview | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "rsbuild-react-ts", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"dev": "rsbuild dev --open", | ||
"build": "rsbuild build", | ||
"preview": "rsbuild preview" | ||
}, | ||
"dependencies": { | ||
"@react-vant/icons": "^0.0.10", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-vant": "^3.2.5" | ||
}, | ||
"devDependencies": { | ||
"@rsbuild/core": "^0.0.25", | ||
"@rsbuild/plugin-react": "^0.0.25", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"typescript": "^5.2.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
export default defineConfig({ | ||
plugins: [pluginReact()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
html, | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
font-size: 16px; | ||
font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; | ||
background-color: #f8f8f8; | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
} | ||
|
||
* { | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
box-sizing: border-box; | ||
} | ||
|
||
.user { | ||
&-poster { | ||
width: 100%; | ||
height: 53vw; | ||
display: block; | ||
} | ||
|
||
&-group { | ||
margin-bottom: 15px; | ||
} | ||
|
||
&-links { | ||
padding: 15px 0; | ||
font-size: 12px; | ||
text-align: center; | ||
background-color: #fff; | ||
|
||
.rv-icon { | ||
font-size: 24px; | ||
margin-bottom: 4px; | ||
} | ||
|
||
.rv-flexitem { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Flex, CellGroup, Cell } from 'react-vant'; | ||
import { | ||
Records, | ||
Tosend, | ||
Logistics, | ||
PendingPayment, | ||
Points, | ||
GoldCoinO, | ||
GiftO, | ||
} from '@react-vant/icons'; | ||
import './App.scss'; | ||
|
||
const App = () => ( | ||
<div className="container-box"> | ||
<main> | ||
<div> | ||
<img | ||
className="user-poster" | ||
src="https://img.yzcdn.cn/public_files/2017/10/23/8690bb321356070e0b8c4404d087f8fd.png" | ||
/> | ||
<Flex className="user-links"> | ||
<Flex.Item span="6"> | ||
<PendingPayment /> | ||
待付款 | ||
</Flex.Item> | ||
<Flex.Item span="6"> | ||
<Records /> | ||
待接单 | ||
</Flex.Item> | ||
<Flex.Item span="6"> | ||
<Tosend /> | ||
待发货 | ||
</Flex.Item> | ||
<Flex.Item span="6"> | ||
<Logistics /> | ||
已发货 | ||
</Flex.Item> | ||
</Flex> | ||
|
||
<CellGroup className="user-group"> | ||
<Cell icon={<Records />} title="全部订单" isLink /> | ||
</CellGroup> | ||
|
||
<CellGroup> | ||
<Cell icon={<Points />} title="我的积分" isLink /> | ||
<Cell icon={<GoldCoinO />} title="我的优惠券" isLink /> | ||
<Cell icon={<GiftO />} title="我收到的礼物" isLink /> | ||
</CellGroup> | ||
</div> | ||
</main> | ||
</div> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="@rsbuild/core/types" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App'; | ||
|
||
const root = ReactDOM.createRoot(document.getElementById('root')!); | ||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"lib": ["DOM", "ES2020"], | ||
"module": "ESNext", | ||
"jsx": "react-jsx", | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"isolatedModules": true, | ||
"resolveJsonModule": true, | ||
"moduleResolution": "bundler" | ||
}, | ||
"include": ["src"] | ||
} |