diff --git a/src/core/client/ui/components/FormField/FormField.mdx b/src/core/client/ui/components/FormField/FormField.mdx index 3dc055085..cfd503953 100644 --- a/src/core/client/ui/components/FormField/FormField.mdx +++ b/src/core/client/ui/components/FormField/FormField.mdx @@ -5,32 +5,18 @@ menu: UI Kit import { Playground, PropsTable } from 'docz' import FormField from './FormField' -import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} from '../core/client/ui/components' -# Flex +# FormField -`FormField` is to be used with Form Components `flexbox`. +`FormField` is to be used with Form Components: `InputLabel`, `InputDescription`, `TextField`, `ValidationMessage`, etc. +FormField manages the gutters between inner elements. It's a form field wrapper of the `Flex` Component. ## Justify content - - - - -## Align items - - - - - - - - -## Direction - - - - - - + + Username + A unique identifier displayed on your comments. You may use “_” and “.” + + Invalid characters. Try again. + diff --git a/src/core/client/ui/components/InputDescription/InputDescription.mdx b/src/core/client/ui/components/InputDescription/InputDescription.mdx index c27a460be..7a68cc49f 100644 --- a/src/core/client/ui/components/InputDescription/InputDescription.mdx +++ b/src/core/client/ui/components/InputDescription/InputDescription.mdx @@ -4,7 +4,7 @@ menu: UI Kit --- import { Playground, PropsTable } from 'docz' -import { InputDescription } from '../core/client/ui/components' +import InputDescription from './InputDescription' # Flex @@ -12,7 +12,5 @@ import { InputDescription } from '../core/client/ui/components' ## Align items - - This is a description - + This is a description diff --git a/src/core/client/ui/components/Spinner/Spinner.css b/src/core/client/ui/components/Spinner/Spinner.css new file mode 100644 index 000000000..5dd6c6acf --- /dev/null +++ b/src/core/client/ui/components/Spinner/Spinner.css @@ -0,0 +1,68 @@ +.root { + display: block; + text-align: center; +} + +.spinner { + animation: rotator 1.4s linear infinite; +} + +@keyframes rotator { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(270deg); + } +} + +.path { + stroke: var(--palette-primary-main); + stroke-dasharray: 187; + stroke-dashoffset: 0; + transform-origin: center; + animation: dash 1.4s ease-in-out infinite, colors 5.6s ease-in-out infinite; +} + +@keyframes colors { + 0% { + stroke: var(--palette-primary-main); + } + 100% { + stroke: var(--palette-primary-light); + } +} + +@keyframes dash { + 0% { + stroke-dashoffset: 187; + } + 50% { + stroke-dashoffset: 46.75; + transform: rotate(135deg); + } + 100% { + stroke-dashoffset: 187; + transform: rotate(450deg); + } +} + +@keyframes fullRotator { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +/* Hack for IE and Edge as they don't support css animations on SVG elements. */ +_:-ms-lang(x), +.path { + stroke-dasharray: 160; +} + +_:-ms-lang(x), +.spinner { + animation: fullRotator 1.4s linear infinite; +} diff --git a/src/core/client/ui/components/Spinner/Spinner.mdx b/src/core/client/ui/components/Spinner/Spinner.mdx new file mode 100644 index 000000000..66ef80309 --- /dev/null +++ b/src/core/client/ui/components/Spinner/Spinner.mdx @@ -0,0 +1,15 @@ +--- +name: Spinner +menu: UI Kit +--- + +import { Playground } from "docz" +import Spinner from "./Spinner" + +# Spinner + +## Basic usage + + + + diff --git a/src/core/client/ui/components/Spinner/Spinner.tsx b/src/core/client/ui/components/Spinner/Spinner.tsx new file mode 100644 index 000000000..2edb5e029 --- /dev/null +++ b/src/core/client/ui/components/Spinner/Spinner.tsx @@ -0,0 +1,46 @@ +import cn from "classnames"; +import React, { StatelessComponent } from "react"; +import { withStyles } from "talk-ui/hocs"; +import * as styles from "./Spinner.css"; + +export interface SpinnerProps { + /** + * Convenient prop to override the root styling. + */ + className?: string; + /** + * Override or extend the styles applied to the component. + */ + classes: typeof styles; +} + +const Spinner: StatelessComponent = props => { + const { className, classes } = props; + + const rootClassName = cn(classes.root, className); + + return ( +
+ + + +
+ ); +}; + +const enhanced = withStyles(styles)(Spinner); +export default enhanced; diff --git a/src/core/client/ui/components/Spinner/index.ts b/src/core/client/ui/components/Spinner/index.ts new file mode 100644 index 000000000..66d1096a0 --- /dev/null +++ b/src/core/client/ui/components/Spinner/index.ts @@ -0,0 +1 @@ +export { default } from "./Spinner"; diff --git a/src/core/client/ui/components/index.ts b/src/core/client/ui/components/index.ts index 76efab87c..52ebe6a79 100644 --- a/src/core/client/ui/components/index.ts +++ b/src/core/client/ui/components/index.ts @@ -16,3 +16,4 @@ export { default as ClickOutside } from "./ClickOutside"; export { default as Popup } from "./Popup"; export { default as FormField } from "./FormField"; export { default as InputDescription } from "./InputDescription"; +export { default as Spinner } from "./Spinner"; diff --git a/src/docs/forms.mdx b/src/docs/forms.mdx index b114cf7e1..547d33701 100644 --- a/src/docs/forms.mdx +++ b/src/docs/forms.mdx @@ -10,13 +10,13 @@ Let's build some forms! We will use the following compoenents `InputLabel`, `Typ ### Examples import { Playground, PropsTable } from 'docz' -import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} from '../core/client/ui/components' +import { InputLabel, ValidationMessage, TextField, InputDescription, Flex, Button, FormField, Typography } from '../core/client/ui/components' # InputLabel ## Simple Form - + Sign up to join the conversation @@ -26,14 +26,13 @@ import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} fro Username - A unique identifier displayed on your comments. You may use “_” and “.” + A unique identifier displayed on your comments. You may use “_” and “.” - Password - Must be at least 8 characters + Must be at least 8 characters @@ -42,14 +41,14 @@ import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} fro - + ## Simple Form with error - + Sign up to join the conversation @@ -59,7 +58,7 @@ import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} fro Username - A unique identifier displayed on your comments. You may use “_” and “.” + A unique identifier displayed on your comments. You may use “_” and “.” Invalid characters. Try again. @@ -67,7 +66,7 @@ import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} fro Password - Must be at least 8 characters + Must be at least 8 characters @@ -76,6 +75,6 @@ import { InputLabel, ValidationMessage, TextField, Typography, Flex, Button} fro - +