-
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(progress): added a
small
state to the CircularProgress
Realized it would be really helpful to have the smaller version from `v1` available again as an option out of the box since the new one is a bit too big.
- Loading branch information
Showing
13 changed files
with
233 additions
and
18 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/documentation/src/components/Demos/Progress/SmallCircularProgress.md
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,2 @@ | ||
The `CircularProgress` also supports a `small` state which defaults to the same | ||
size as icons from the #icon package. |
21 changes: 21 additions & 0 deletions
21
packages/documentation/src/components/Demos/Progress/SmallCircularProgress.tsx
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,21 @@ | ||
import React, { ReactElement, useEffect } from "react"; | ||
import { useTimeout, useToggle } from "@react-md/utils"; | ||
import { Button } from "@react-md/button"; | ||
import { CircularProgress } from "@react-md/progress"; | ||
|
||
export default function SmallCircularProgress(): ReactElement | null { | ||
const [loading, enable, disable] = useToggle(false); | ||
const [start] = useTimeout(disable, 10000); | ||
useEffect(() => { | ||
if (loading) { | ||
start(); | ||
} | ||
}, [loading, start]); | ||
|
||
return ( | ||
<> | ||
<Button onClick={enable}>Show</Button> | ||
{loading && <CircularProgress id="small-circular-progress" small />} | ||
</> | ||
); | ||
} |
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
53 changes: 53 additions & 0 deletions
53
packages/documentation/src/constants/sandboxes/Progress-SmallCircularProgress.json
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,53 @@ | ||
{ | ||
"public/index.html": { | ||
"content": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"\n />\n <meta name=\"theme-color\" content=\"#000000\" />\n <link\n rel=\"stylesheet\"\n href=\"https://fonts.googleapis.com/css?family=Material+Icons|Roboto:400,500,700|Source+Code+Pro\"\n />\n <link\n rel=\"stylesheet\"\n href=\"https://unpkg.com/react-md@{{RMD_VERSION}}/dist/css/react-md.teal-pink-200-light.min.css\"\n />\n <title>Progress Example - Small Circular Progress</title>\n </head>\n <body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n </body>\n</html>\n", | ||
"isBinary": false | ||
}, | ||
"src/index.tsx": { | ||
"content": "import React from \"react\";\nimport { render } from \"react-dom\";\nimport { Configuration } from \"@react-md/layout\";\n\nimport Demo from \"./Demo\";\n\nconst App = () => (\n <Configuration>\n <Demo />\n </Configuration>\n);\n\nrender(<App />, document.getElementById(\"root\"));\n", | ||
"isBinary": false | ||
}, | ||
"src/styles.scss": { | ||
"content": "@import \"variables\";\n@import \"~@react-md/button/dist/mixins\";\n@import \"~@react-md/layout/dist/mixins\";\n@import \"~@react-md/progress/dist/mixins\";\n@import \"~@react-md/states/dist/mixins\";\n@import \"~@react-md/theme/dist/mixins\";\n@import \"~@react-md/typography/dist/mixins\";\n@import \"~@react-md/utils/dist/mixins\";\n\n@include react-md-utils;\n", | ||
"isBinary": false | ||
}, | ||
"src/_variables.scss": { | ||
"content": "@import \"~@react-md/theme/dist/color-palette\";\n\n$rmd-theme-light: true;\n$rmd-theme-primary: $rmd-teal-500;\n$rmd-theme-secondary: $rmd-pink-a-200;\n", | ||
"isBinary": false | ||
}, | ||
"package.json": { | ||
"content": { | ||
"title": "Progress Example - Small Circular Progress", | ||
"description": "Example from https://react-md.dev/packages/progress/demos#small-circular-progress", | ||
"main": "src/index.tsx", | ||
"dependencies": { | ||
"@react-md/button": "latest", | ||
"@react-md/layout": "latest", | ||
"@react-md/progress": "latest", | ||
"@react-md/states": "latest", | ||
"@react-md/theme": "latest", | ||
"@react-md/typography": "latest", | ||
"@react-md/utils": "latest", | ||
"react": "latest", | ||
"react-dom": "latest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "latest", | ||
"@types/node": "latest", | ||
"@types/react": "latest", | ||
"@types/react-dom": "latest", | ||
"node-sass": "latest", | ||
"react-scripts": "latest", | ||
"typescript": "latest" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start" | ||
} | ||
}, | ||
"isBinary": false | ||
}, | ||
"src/Demo.tsx": { | ||
"content": "import React, { ReactElement, useEffect } from \"react\";\nimport { useTimeout, useToggle } from \"@react-md/utils\";\nimport { Button } from \"@react-md/button\";\nimport { CircularProgress } from \"@react-md/progress\";\n\nexport default function SmallCircularProgress(): ReactElement | null {\n const [loading, enable, disable] = useToggle(false);\n const [start] = useTimeout(disable, 10000);\n useEffect(() => {\n if (loading) {\n start();\n }\n }, [loading, start]);\n\n return (\n <>\n <Button onClick={enable}>Show</Button>\n {loading && <CircularProgress id=\"small-circular-progress\" small />}\n </>\n );\n}\n", | ||
"isBinary": false | ||
} | ||
} |
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
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
Oops, something went wrong.