From 6c299914e9d95d31f62fef17912b91b700012a09 Mon Sep 17 00:00:00 2001 From: tcbegley Date: Fri, 27 Nov 2020 22:57:31 +0000 Subject: [PATCH] Clean up demo --- demo/Demo.js | 686 +++++++++++++++++++++++++-------------------------- 1 file changed, 343 insertions(+), 343 deletions(-) diff --git a/demo/Demo.js b/demo/Demo.js index f91b9f4cd..43fe5fe88 100644 --- a/demo/Demo.js +++ b/demo/Demo.js @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, {useState} from 'react'; import { Alert, Badge, @@ -8,11 +8,10 @@ import { CardBody, CardDeck, CardFooter, - CardGroup, CardHeader, CardImg, - CardImgOverlay, CardLink, + Checklist, Col, Collapse, Container, @@ -22,7 +21,6 @@ import { Form, FormFeedback, FormGroup, - FormText, Input, Jumbotron, Label, @@ -37,343 +35,331 @@ import { PopoverBody, PopoverHeader, Progress, + RadioItems, Row, - Tab, - Tabs, Table, Textarea, - Tooltip, + Tooltip } from '../src'; -class CollapseComponent extends Component { - constructor(props) { - super(props); - this.toggle = this.toggle.bind(this); - this.state = { - collapse: false - }; - } - - toggle() { - this.setState({ - collapse: !this.state.collapse - }); - } - - render() { - return (
- - - {this.props.children} - -
); - } -} - -class FadeComponent extends Component { - constructor(props) { - super(props); - this.toggle = this.toggle.bind(this); - this.state = { - fadeIn: true - }; - } - - toggle() { - this.setState({ - fadeIn: !this.state.fadeIn - }); - } - - render() { - return (
- - - {this.props.children} - -
) - } -} - -class PopoverComponent extends Component { - constructor(props) { - super(props); - this.toggle = this.toggle.bind(this); - this.state = {popoverOpen: false}; - } - - toggle() { - this.setState({ - popoverOpen: !this.state.popoverOpen - }) - } - - render() { - return(
-

Click on the word popover

- - Popover header - Popover body +const StateWrapper = ({tag: Tag, ...otherProps}) => { + // helper to mimic setProps functionality + const [state, setState] = useState(otherProps); + return setState({...state, ...props})} {...state} />; +}; + +const CollapseComponent = ({children}) => { + const [isOpen, setIsOpen] = useState(false); + + return ( +
+ + {children} +
+ ); +}; + +const FadeComponent = ({children}) => { + const [isOpen, setIsOpen] = useState(false); + + return ( +
+ + {children} +
+ ); +}; + +const PopoverComponent = () => { + const [isOpen, setIsOpen] = useState(false); + + return ( +
+

+ Click on the word{' '} + setIsOpen(!isOpen)} + > + popover + +

+ + Header + This is the body of the popover -
); - } -} - -class Demo extends Component { - render() { - return ( - - - A link - - - Entry 1 - Entry 2 - - Entry 3 - - - -

Dash Bootstrap Components

-

Alerts

-
- - This is a primary alert - - - This is a secondary alert - - - This is a success alert - - - This is a danger alert - - - This is a warning alert - - - This is a info alert - - - This is a light alert - - - This is a dark alert - -
- -
- -

Badges

-

{"A heading with a badge "} - New! -

-

{"Do you take the "} - red pill - {" or the "} - blue pill -

- -
- -

Buttons

-
- {' '} - {' '} - {' '} - {' '} - {' '} - {' '} - -
-
-

Outline buttons

-
- {' '} - {' '} - {' '} - {' '} - {' '} - {' '} - -
-
-

Block button

-
- {' '} -
-

Button Group

-
- - - - - -
- -
- -

Cards

- - - - - Header - -
This card has a header
-

And some text in the body

-
-
- - - - - -
Card with image
-

This card has an image

-
-
- - - - -
Here's another card
-

With some text, and a button

- -
-
- - - - -
Here's yet another card
-

With some text, and some links

- External - Internal -
-
- -
- -

Card deck

- - +
+ ); +}; + +const Demo = () => ( + + + + A link + + + Entry 1 + Entry 2 + + Entry 3 + + + +

Dash Bootstrap Components - Demo

+

+ This demonstrates all of the Dash Bootstrap Components as React + components. It is mainly intended as a tool for development. +

+

Alerts

+
+ This is a primary alert + This is a secondary alert + This is a success alert + This is a danger alert + This is a warning alert + This is a info alert + This is a light alert + This is a dark alert +
+ +

Badges

+

+ {'A heading with a badge '} + New! +

+

+ {'Do you take the '} + + red pill + + {' or the '} + + blue pill + +

+ +

Buttons

+
+ {' '} + {' '} + {' '} + {' '} + {' '} + {' '} + +
+ +

Outline buttons

+
+ {' '} + {' '} + {' '} + {' '} + {' '} + {' '} + +
+ +

Block button

+
+ {' '} +
+

Button Group

+
+ + + + + +
+ +

Cards

+ + + + + Header -
The first card
-

- This is a card with some text on it, it's the first one in the deck. -

+
This card has a header
+

And some text in the body

+ Footer
+ + + -
The second card
-

- This is a card with some text on it, it's the second one in the deck. It has a bit more text in it so that we can see how the vertical spacing will work. -

+
Card with image
+

This card has an image

- + + + -
The third card
-
...and the last :(
-

- This card doesn't have much text... -

- +
Here's another card
+

With some text, and a button

+
- - -
- -

Collapse

- + + - This content is hidable in the collapse element. +
Here's yet another card
+

With some text, and some links

+ + External + + Internal
-
- -
+ +
-

Columns

- - -
-

A quarter width column

-
- - -
-

A half width column

-

With some text below

-
- - -
-

A quarter width column

-
- -
+

Card deck

+ + + +
The first card
+

+ This is a card with some text on it, it's the first one in the + deck. +

+
+
+ + +
The second card
+

+ This is a card with some text on it, it's the second one in the + deck. It has a bit more text in it so that we can see how the + vertical spacing will work. +

+
+
+ + +
The third card
+
...and the last :(
+

This card doesn't have much text...

+ +
+
+
-

Row with no gutters

- - -
-

A quarter width column

-
- - -
-

A half width column

-

With some text below

-
- - -
+

Collapse

+ + + This content is hidable in the collapse element. + + + +

Columns

+ + +
+

A quarter width column

+
+ + +
+

A half width column

+

With some text below

+
+ + +

A quarter width column

-
+

Row with no gutters

+ + +
+

A quarter width column

+
+ + +
+

A half width column

+

With some text below

+
+ + +
+

A quarter width column

+
+ +

DropdownMenu

Heading An item - + Another heading Another item -
-

Fade

@@ -384,29 +370,37 @@ class Demo extends Component { -
-

Form

- + That email is valid! - + That password is invalid... :( -