-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add status fn/items nested condition
- Loading branch information
Showing
8 changed files
with
59 additions
and
225 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,107 +1,23 @@ | ||
import React from 'react'; | ||
import ReactStatusManager from '../../lib/src'; | ||
import '@jswork/react-status-manager/src/style.scss'; | ||
import './App.css'; | ||
|
||
class App extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
value: 'init', | ||
smvalue: 'N', | ||
step: 0, | ||
}; | ||
} | ||
|
||
click1 = (e) => { | ||
this.setState({ value: 'init' }); | ||
console.log('click1'); | ||
}; | ||
click2 = (e) => { | ||
this.setState({ value: 'active' }); | ||
console.log('click2'); | ||
}; | ||
click3 = (e) => { | ||
this.setState({ value: 'running' }); | ||
console.log('click3'); | ||
}; | ||
click4 = (e) => { | ||
this.setState({ value: 'finish' }); | ||
console.log('click4'); | ||
}; | ||
|
||
_click5 = (e) => { | ||
this.setState({ | ||
smvalue: 'A', | ||
}); | ||
}; | ||
|
||
_clickStep = (e) => { | ||
let step = this.state.step; | ||
this.setState({ | ||
step: step === 3 ? 0 : step + 1, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<> | ||
<ReactStatusManager | ||
as="div" | ||
size="16px" | ||
value={this.state.value} | ||
items={['init', 'active', 'running', 'finish']}> | ||
<span>下拉刷新</span> | ||
<span>释放更新</span> | ||
<img | ||
width="30" | ||
src={'https://assets-cdn.shimo.im/assets/images/loading-b67e5a67dc.gif'} | ||
alt="" | ||
/> | ||
<span>更新完毕</span> | ||
</ReactStatusManager> | ||
|
||
<ReactStatusManager | ||
as="div" | ||
value={this.state.smvalue} | ||
className={`wp-icon-${this.state.smvalue}`} | ||
items={['N', 'A', 'F']}> | ||
<span>未开始</span> | ||
<span>进行中</span> | ||
<span>已经结束</span> | ||
</ReactStatusManager> | ||
|
||
<button className="button is-primary is-fullwidth mb-2" onClick={this.click1}> | ||
to `init` | ||
</button> | ||
<button className="button is-primary is-fullwidth mb-2" onClick={this.click2}> | ||
to `active` | ||
</button> | ||
<button className="button is-primary is-fullwidth mb-2" onClick={this.click3}> | ||
to `running` | ||
</button> | ||
<button className="button is-primary is-fullwidth mb-2" onClick={this.click4}> | ||
to `finish` | ||
</button> | ||
<button className="button is-primary is-fullwidth mb-2" onClick={this._click5}> | ||
SetSMvalue | ||
</button> | ||
|
||
<h2>Wizard</h2> | ||
<button className="button is-primary is-fullwidth mb-2" onClick={this._clickStep}> | ||
next step | ||
</button> | ||
<ReactStatusManager value={this.state.step} items={[0, 1, 2, 3]}> | ||
<div className="step">step1,input password</div> | ||
<div className="step">step2,input phone</div> | ||
<div className="step">step3,input other info</div> | ||
<div className="step"> | ||
step4,do submit! <button>SUBMIT</button> | ||
</div> | ||
</ReactStatusManager> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
import { useState } from 'react'; | ||
import Rsm from '@jswork/react-status-manager/src'; | ||
|
||
const App = () => { | ||
const [s1, setS1] = useState('init'); | ||
|
||
return ( | ||
<div> | ||
<h3>Normal Case</h3> | ||
<nav> | ||
<button onClick={() => setS1('a')}>A</button> | ||
<button onClick={() => setS1('b')}>B</button> | ||
<button onClick={() => setS1('c')}>C</button> | ||
</nav> | ||
<Rsm items={['a', 'b', 'c']} value={s1}> | ||
<div>Status - A</div> | ||
<div>Status - B</div> | ||
<div>Status - C</div> | ||
</Rsm> | ||
</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 |
---|---|---|
@@ -1,69 +1,3 @@ | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
-webkit-text-size-adjust: 100%; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
place-items: center; | ||
min-width: 320px; | ||
min-height: 100vh; | ||
} | ||
|
||
h1 { | ||
font-size: 3.2em; | ||
line-height: 1.1; | ||
} | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s; | ||
} | ||
button:hover { | ||
border-color: #646cff; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
color: #213547; | ||
background-color: #ffffff; | ||
} | ||
a:hover { | ||
color: #747bff; | ||
} | ||
button { | ||
background-color: #f9f9f9; | ||
} | ||
} | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
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,11 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: [ | ||
"./index.html", | ||
"./src/**/*.{js,ts,jsx,tsx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |
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 was deleted.
Oops, something went wrong.