-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05fddf1
commit e0cec62
Showing
14 changed files
with
262 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
PageSection, | ||
TextContent, | ||
Title, | ||
Text, | ||
FlexItem, | ||
Flex, | ||
Button, | ||
TextList, | ||
TextListItem, | ||
} from '@patternfly/react-core'; | ||
import * as React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { Keyword } from './Keyword'; | ||
|
||
|
||
export const Installation: React.FunctionComponent<any> = ({ children, ...props }) => { | ||
return ( | ||
<PageSection {...props}> | ||
<TextContent> | ||
<Title size={'3xl'}>Installation</Title> | ||
<Text>You can install <Keyword>use-patternfly</Keyword> from npm:</Text> | ||
<Text component={'blockquote'}> | ||
npm install use-patternfly --save | ||
</Text> | ||
<Text>Or if you're using Yarn:</Text> | ||
<Text component={'blockquote'}> | ||
yarn add use-patternfly | ||
</Text> | ||
<Text> | ||
This package requires the following packages as peer dependencies: | ||
</Text> | ||
<TextList> | ||
<TextListItem><Keyword>@patternfly/react-core</Keyword></TextListItem> | ||
<TextListItem><Keyword>@patternfly/react-styles</Keyword></TextListItem> | ||
<TextListItem><Keyword>@patternfly/react-icons</Keyword></TextListItem> | ||
<TextListItem><Keyword>react-router</Keyword></TextListItem> | ||
<TextListItem><Keyword>react-router-dom</Keyword></TextListItem> | ||
</TextList> | ||
<Text> | ||
Please make sure to install them as well. You'll need <Keyword>react@16.8.0</Keyword> | ||
or later since the package uses hooks. | ||
</Text> | ||
<Text> | ||
Some of the provided components and hooks could require additional dependencies. | ||
</Text> | ||
</TextContent> | ||
<Flex> | ||
<FlexItem breakpointMods={[{modifier: 'align-right', breakpoint: 'sm'}]}> | ||
<Link to={'/getting-started/usage'}><Button component={'div'}>Usage</Button></Link> | ||
</FlexItem> | ||
</Flex> | ||
</PageSection> | ||
); | ||
} |
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,18 @@ | ||
import * as React from 'react'; | ||
import { css, StyleSheet } from '@patternfly/react-styles'; | ||
|
||
const styles = StyleSheet.create({ | ||
keyword: { | ||
display: 'inline-block', | ||
backgroundColor: `var(--pf-global--BackgroundColor--light-200)`, | ||
fontFamily: 'monospace', | ||
padding: '3px', | ||
borderRadius: '3px' | ||
} | ||
}); | ||
|
||
export const Keyword: React.FunctionComponent = props => | ||
<span | ||
{...props} | ||
className={css(styles.keyword)} | ||
/>; |
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,50 @@ | ||
import * as React from 'react'; | ||
import { PageSection, TextContent, Title, Text, FlexItem, Flex, Button } from '@patternfly/react-core'; | ||
import { Link } from 'react-router-dom'; | ||
import logo from '../use-patternfly.png'; | ||
import { Keyword } from './Keyword'; | ||
|
||
export const Overview: React.FunctionComponent<any> = ({ children, ...props }) => { | ||
return ( | ||
<> | ||
<PageSection variant={'dark'} style={{ textAlign: 'center' }}> | ||
<img src={logo} alt={'use-patternfly logo'} /> | ||
</PageSection> | ||
<PageSection {...props}> | ||
<TextContent> | ||
<Title size={'3xl'}>Overview</Title> | ||
<Text> | ||
<Keyword>use-patternfly</Keyword> is an opinionated set of hooks and components useful when building a React app with <a href={'https://patternfly.org'}>PatternFly</a>. | ||
</Text> | ||
<Text> | ||
This project aims to encourage code reuse between all projects using PatternFly and to showcase how to implement features like fetching from an API and showing the data in a DataList or Table component. | ||
</Text> | ||
|
||
<Title size={'xl'} headingLevel={'h2'}>Motivation</Title> | ||
<Text> | ||
Since I (<a href={'https://twitter.com/riccardoforina'}>@riccardoforina</a>) started | ||
building apps using PatternFly, I found myself writing solutions to the same problem | ||
many times. But how many ways can there be to <Link to={'/api/useDocumentTitle'}>set the document title</Link> or <Link to={'/api/AppLayout'}>wrap an app in a PatternFly chrome</Link>? I felt the need | ||
to finalize these solutions in something reusable and well-tested, to finally | ||
be able to focus on the app needs instead of re-learning how to wire PatternFly's | ||
components once again. | ||
</Text> | ||
|
||
<Title size={'xl'} headingLevel={'h2'}>Dependencies</Title> | ||
<Text>The only real dependency-other than PatternFly itself-is <a href={'https://github.com/ReactTraining/react-router'}>react-router</a>, | ||
although it's listed as a peer dependency to avoid clashing with whatever | ||
version you are running on your project. Other utilities might have extra | ||
dependencies, but if you don't plan on using that specific utility you | ||
don't need to install them. | ||
</Text> | ||
</TextContent> | ||
|
||
<Flex> | ||
<FlexItem breakpointMods={[{modifier: 'align-right', breakpoint: 'sm'}]}> | ||
<Link to={'/getting-started/installation'}><Button as={'div'}>Installation</Button></Link> | ||
</FlexItem> | ||
</Flex> | ||
</PageSection> | ||
</> | ||
); | ||
} |
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,41 @@ | ||
import { | ||
PageSection, | ||
TextContent, | ||
Title, | ||
Text, | ||
FlexItem, | ||
Flex, | ||
Button, | ||
} from '@patternfly/react-core'; | ||
import * as React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Usage: React.FunctionComponent<any> = ({ children, ...props }) => { | ||
return ( | ||
<PageSection {...props}> | ||
<TextContent> | ||
<Title size={'3xl'}>Usage</Title> | ||
<Text>Import the component or hook that you need using the object destructuring syntax:</Text> | ||
</TextContent> | ||
|
||
<iframe style={{height: 565, width: "100%", margin: '20px 0'}} scrolling={'no'} title="use-patternfly-usage-example" | ||
src="https://codepen.io/riccardo-forina/embed/oNNjjqv?height=265&theme-id=0&default-tab=js" | ||
frameBorder="no" allowFullScreen={true}> | ||
See the Pen <a href='https://codepen.io/riccardo-forina/pen/oNNjjqv'>use-patternfly-usage-example</a> by | ||
Riccardo Forina | ||
(<a href='https://codepen.io/riccardo-forina'>@riccardo-forina</a>) on <a | ||
href='https://codepen.io'>CodePen</a>. | ||
</iframe> | ||
|
||
<TextContent> | ||
<Text>Another source of usage examples is <a href={'https://github.com/riccardo-forina/use-patternfly/tree/master/example'}>the code behind this website</a>.</Text> | ||
</TextContent> | ||
|
||
<Flex> | ||
<FlexItem breakpointMods={[{modifier: 'align-right', breakpoint: 'sm'}]}> | ||
<Link to={'/api'}><Button component={'div'}>API</Button></Link> | ||
</FlexItem> | ||
</Flex> | ||
</PageSection> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export * from './Support'; | ||
export * from './DashboardLayout'; | ||
export * from './DashboardParams'; | ||
export * from './DashboardSimple'; | ||
export * from './GettingStarted'; | ||
export * from './Installation'; | ||
export * from './Overview'; | ||
export * from './Usage'; | ||
export * from './Keyword'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from 'react'; | ||
import { useA11yRouteContainer, useDocumentTitle } from 'use-patternfly'; | ||
import { Installation } from '../components'; | ||
|
||
export default function InstallationPage() { | ||
const a11yContainerProps = useA11yRouteContainer(); | ||
useDocumentTitle('Installation'); | ||
return ( | ||
<Installation {...a11yContainerProps} /> | ||
); | ||
} |
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,11 @@ | ||
import * as React from 'react'; | ||
import { useA11yRouteContainer, useDocumentTitle } from 'use-patternfly'; | ||
import { Overview } from '../components'; | ||
|
||
export default function OverviewPage() { | ||
const a11yContainerProps = useA11yRouteContainer(); | ||
useDocumentTitle('Overview'); | ||
return ( | ||
<Overview {...a11yContainerProps} /> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import * as React from 'react'; | ||
import { useA11yRouteContainer, useDocumentTitle } from 'use-patternfly'; | ||
import { Support } from '../components'; | ||
import { Usage } from '../components'; | ||
|
||
export default function SupportPage() { | ||
export default function UsagePage() { | ||
const a11yContainerProps = useA11yRouteContainer(); | ||
useDocumentTitle('Support'); | ||
useDocumentTitle('Usage'); | ||
return ( | ||
<Support {...a11yContainerProps} /> | ||
<Usage {...a11yContainerProps} /> | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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