diff --git a/packages/react-core/src/components/Hint/examples/Hint.md b/packages/react-core/src/components/Hint/examples/Hint.md index d09610a680e..b29df2aed1a 100644 --- a/packages/react-core/src/components/Hint/examples/Hint.md +++ b/packages/react-core/src/components/Hint/examples/Hint.md @@ -9,175 +9,10 @@ propComponents: ['Hint', 'HintTitle', 'HintBody', 'HintFooter'] ### Basic with title -```js -import React from 'react'; -import { - Hint, - HintTitle, - HintBody, - HintFooter, - Button, - Dropdown, - DropdownToggle, - DropdownItem, - DropdownSeparator, - DropdownPosition, - DropdownDirection, - KebabToggle -} from '@patternfly/react-core'; - -class BasicHint extends React.Component { - constructor(props) { - super(props); - this.state = { - isOpen: false - }; - this.onToggle = isOpen => { - this.setState({ - isOpen - }); - }; - this.onSelect = event => { - this.setState({ - isOpen: !this.state.isOpen - }); - }; - } - - render() { - const { isOpen } = this.state; - const dropdownItems = [ - Link, - - Action - , - - Disabled Link - , - - Disabled Action - , - , - Separated Link, - - Separated Action - - ]; - const actions = ( - } - isOpen={isOpen} - dropdownItems={dropdownItems} - position="right" - isPlain - /> - ); - return ( - - Do more with Find it Fix it capabilities - - Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. - - - - - - ); - } -} +```ts file="HintBasicWithTitle.tsx" ``` ### Basic without title -```js -import React from 'react'; -import { - Hint, - HintBody, - HintFooter, - Button, - Dropdown, - DropdownToggle, - DropdownItem, - DropdownSeparator, - DropdownPosition, - DropdownDirection, - KebabToggle -} from '@patternfly/react-core'; - -class BasicHint extends React.Component { - constructor(props) { - super(props); - this.state = { - isOpen: false - }; - this.onToggle = isOpen => { - this.setState({ - isOpen - }); - }; - this.onSelect = event => { - this.setState({ - isOpen: !this.state.isOpen - }); - }; - } - - render() { - const { isOpen } = this.state; - const dropdownItems = [ - Link, - - Action - , - - Disabled Link - , - - Disabled Action - , - , - Separated Link, - - Separated Action - - ]; - const actions = ( - } - isOpen={isOpen} - dropdownItems={dropdownItems} - position="right" - isPlain - /> - ); - return ( - - - - Welcome to the new documentation experience. - - - -
- - - Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. - - - - - -
- ); - } -} +```ts file="HintBasicWithoutTitle.tsx" ``` diff --git a/packages/react-core/src/components/Hint/examples/HintBasicWithTitle.tsx b/packages/react-core/src/components/Hint/examples/HintBasicWithTitle.tsx new file mode 100644 index 00000000000..d84282ebd37 --- /dev/null +++ b/packages/react-core/src/components/Hint/examples/HintBasicWithTitle.tsx @@ -0,0 +1,65 @@ +import React from 'react'; +import { + Hint, + HintTitle, + HintBody, + HintFooter, + Button, + Dropdown, + DropdownItem, + DropdownSeparator, + KebabToggle +} from '@patternfly/react-core'; + +export const HintBasicWithTitle: React.FunctionComponent = () => { + const [isOpen, setIsOpen] = React.useState(false); + + const onToggle = (isOpen: boolean) => { + setIsOpen(isOpen); + }; + + const onSelect = () => { + setIsOpen(!isOpen); + }; + + const dropdownItems = [ + Link, + + Action + , + + Disabled Link + , + + Disabled Action + , + , + Separated Link, + + Separated Action + + ]; + const actions = ( + } + isOpen={isOpen} + dropdownItems={dropdownItems} + position="right" + isPlain + /> + ); + return ( + + Do more with Find it Fix it capabilities + + Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. + + + + + + ); +}; diff --git a/packages/react-core/src/components/Hint/examples/HintBasicWithoutTitle.tsx b/packages/react-core/src/components/Hint/examples/HintBasicWithoutTitle.tsx new file mode 100644 index 00000000000..ec7c1055cb3 --- /dev/null +++ b/packages/react-core/src/components/Hint/examples/HintBasicWithoutTitle.tsx @@ -0,0 +1,74 @@ +import React from 'react'; +import { + Hint, + HintBody, + HintFooter, + Button, + Dropdown, + DropdownItem, + DropdownSeparator, + KebabToggle +} from '@patternfly/react-core'; + +export const HintBasicWithoutTitle: React.FunctionComponent = () => { + const [isOpen, setIsOpen] = React.useState(false); + + const onToggle = (isOpen: boolean) => { + setIsOpen(isOpen); + }; + + const onSelect = () => { + setIsOpen(!isOpen); + }; + + const dropdownItems = [ + Link, + + Action + , + + Disabled Link + , + + Disabled Action + , + , + Separated Link, + + Separated Action + + ]; + const actions = ( + } + isOpen={isOpen} + dropdownItems={dropdownItems} + position="right" + isPlain + /> + ); + return ( + + + + Welcome to the new documentation experience. + + + +
+ + + Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. + + + + + +
+ ); +};