Skip to content

Commit

Permalink
feat: upgrade Wave Progress Ball, add adaptive prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Heuluck committed May 28, 2024
1 parent 81af201 commit bdd861e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 76 deletions.
24 changes: 19 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "react-wave-progress-ball-svg/dist/style.css";

function App() {
const [value, setValue] = useState<number>(50);
const [adaptive, setAdaptive] = useState<boolean>(false);
const [size, setSize] = useState<number>(350);
const [circleColor, setCircleColor] = useState<string>("#bdc3c7");
const [circleLineWidth, setCircleLineWidth] = useState<number>(1);
Expand All @@ -34,6 +35,7 @@ function App() {
const [reverseWaveBg, setReverseWaveBg] = useState<boolean>(false);
const setting = {
size,
adaptive,
circleColor,
circleLineWidth,
waveHeight,
Expand Down Expand Up @@ -62,9 +64,19 @@ function App() {
<Form.Item label="液面高度">
<Slider key="height" defaultValue={value} onChange={setValue} min={0} max={100} step={1} />
</Form.Item>
<Form.Item label="球的大小">
<Slider key="size" defaultValue={size} onChange={setSize} min={10} max={1000} step={1} />
<Form.Item label="是否自适应外框大小">
<Switch
value={adaptive}
onChange={setAdaptive}
checkedChildren="适应大小"
unCheckedChildren="固定大小"
/>
</Form.Item>
{!adaptive && (
<Form.Item label="球的大小">
<Slider key="size" defaultValue={size} onChange={setSize} min={10} max={1000} step={1} />
</Form.Item>
)}
</>
),
},
Expand Down Expand Up @@ -307,7 +319,10 @@ function App() {
label: "导出设置",
children: (
<>
<Button block type="primary" onClick={() => navigator.clipboard.writeText(JSON.stringify(setting, null, 2))}>
<Button
block
type="primary"
onClick={() => navigator.clipboard.writeText(JSON.stringify(setting, null, 2))}>
复制
</Button>
<span className="output">{JSON.stringify(setting, null, 2)}</span>
Expand All @@ -333,8 +348,7 @@ function App() {
);
}


function ExampleCode(props:any) {
function ExampleCode(props: any) {
return (
<span
style={{
Expand Down
75 changes: 4 additions & 71 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -569,23 +569,6 @@
rc-resize-observer "^1.3.1"
rc-util "^5.38.0"

"@rollup/plugin-typescript@^11.1.6":
version "11.1.6"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz#724237d5ec12609ec01429f619d2a3e7d4d1b22b"
integrity sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==
dependencies:
"@rollup/pluginutils" "^5.1.0"
resolve "^1.22.1"

"@rollup/pluginutils@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0"
integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==
dependencies:
"@types/estree" "^1.0.0"
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rollup/[email protected]":
version "4.18.0"
resolved "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz#bbd0e616b2078cd2d68afc9824d1fadb2f2ffd27"
Expand Down Expand Up @@ -699,7 +682,7 @@
dependencies:
"@babel/types" "^7.20.7"

"@types/[email protected]", "@types/estree@^1.0.0":
"@types/[email protected]":
version "1.0.5"
resolved "https://registry.npmmirror.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
Expand Down Expand Up @@ -1240,11 +1223,6 @@ estraverse@^5.1.0, estraverse@^5.2.0:
resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==

estree-walker@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==

esutils@^2.0.2:
version "2.0.3"
resolved "https://registry.npmmirror.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
Expand Down Expand Up @@ -1329,11 +1307,6 @@ fsevents@~2.3.2, fsevents@~2.3.3:
resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==

gensync@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.npmmirror.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
Expand Down Expand Up @@ -1404,13 +1377,6 @@ has-flag@^4.0.0:
resolved "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

hasown@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
dependencies:
function-bind "^1.1.2"

ignore@^5.2.0, ignore@^5.3.1:
version "5.3.1"
resolved "https://registry.npmmirror.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
Expand Down Expand Up @@ -1442,13 +1408,6 @@ inherits@2:
resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==

is-core-module@^2.13.0:
version "2.13.1"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==
dependencies:
hasown "^2.0.0"

is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
Expand Down Expand Up @@ -1663,11 +1622,6 @@ path-key@^3.1.0:
resolved "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==

path-type@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
Expand Down Expand Up @@ -2082,15 +2036,13 @@ react-refresh@^0.14.2:
integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==

react-wave-progress-ball-svg@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-wave-progress-ball-svg/-/react-wave-progress-ball-svg-1.0.2.tgz#485b6d766e3531f6f97bab023c91a94ee4341e0e"
integrity sha512-TmXkNu0se1lUx5YYeiaBZY0UJOvgyrIsnvq6NK4LUWJxwiXdXezYSmRZfoAiClLWZEKELuS8PgyMW7PD5DUXvQ==
version "1.1.1"
resolved "https://registry.yarnpkg.com/react-wave-progress-ball-svg/-/react-wave-progress-ball-svg-1.1.1.tgz#aed37c2ebd569105509dc901539ac7a63315444e"
integrity sha512-XvQueIeT2MCgtupMFNe+mBdStQpiiUScNXndT6W9O/XOATWBVHawWzjcwMPbaTTA1KtQmTVqxbHko0shFGadYw==
dependencies:
"@rollup/plugin-typescript" "^11.1.6"
"@types/node" "^20.12.12"
react "^18.2.0"
react-dom "^18.2.0"
tslib "^2.6.2"

react@^18.2.0:
version "18.3.1"
Expand All @@ -2114,15 +2066,6 @@ resolve-from@^4.0.0:
resolved "https://registry.npmmirror.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==

resolve@^1.22.1:
version "1.22.8"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d"
integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
dependencies:
is-core-module "^2.13.0"
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"

reusify@^1.0.4:
version "1.0.4"
resolved "https://registry.npmmirror.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
Expand Down Expand Up @@ -2249,11 +2192,6 @@ supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"

supports-preserve-symlinks-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==

text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.npmmirror.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
Expand Down Expand Up @@ -2286,11 +2224,6 @@ ts-api-utils@^1.3.0:
resolved "https://registry.npmmirror.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1"
integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==

tslib@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.npmmirror.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
Expand Down

0 comments on commit bdd861e

Please sign in to comment.