| 1 |
import { useState } from 'react'; |
| 2 |
import { BackToTop, Card, CardBody, Content, Gallery, GalleryItem, PageSection, Switch } from '@patternfly/react-core'; |
| 3 |
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; |
| 4 |
|
| 5 |
export const BacktoTopNameDemo: React.FunctionComponent = () => { |
| 6 |
const [isAlwaysVisible, setIsAlwaysVisible] = useState(false); |
| 7 |
|
| 8 |
const handleChange = (_event, isChecked) => { |
| 9 |
setIsAlwaysVisible(isChecked); |
| 10 |
}; |
| 11 |
|
| 12 |
return ( |
| 13 |
<DashboardWrapper breadcrumb={null}> |
| 14 |
<PageSection aria-labelledby="main-title"> |
| 15 |
<Content> |
| 16 |
<h1 id="main-title">Main title</h1> |
| 17 |
<p> |
| 18 |
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br /> |
| 19 |
of it’s relative line height of 1.5. |
| 20 |
</p> |
| 21 |
<Switch label="Always show BackToTopButton" onChange={handleChange} isChecked={isAlwaysVisible} /> |
| 22 |
</Content> |
| 23 |
</PageSection> |
| 24 |
<PageSection |
| 25 |
hasOverflowScroll |
| 26 |
tabIndex={0} |
| 27 |
aria-label="Scrollable container of demonstration cards with a back to top element" |
| 28 |
> |
| 29 |
<Gallery hasGutter> |
| 30 |
{Array.from({ length: 60 }).map((_value, index) => ( |
| 31 |
<GalleryItem key={index}> |
| 32 |
<Card key={index}> |
| 33 |
<CardBody> |
| 34 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas fermentum et urna eget semper. Sed |
| 35 |
tincidunt purus diam, id sollicitudin est pellentesque eget. Ut eget massa dignissim dolor pretium |
| 36 |
finibus at sit amet purus. Duis vulputate odio ac tristique convallis. Praesent porttitor condimentum |
| 37 |
varius. Duis pharetra in ligula nec ornare. Vivamus tincidunt nulla a semper semper. Duis tincidunt |
| 38 |
gravida elit non vehicula. Nunc eu sem venenatis, lobortis lorem sed, consectetur erat. Nulla |
| 39 |
accumsan, justo ac fringilla imperdiet, risus magna mollis libero, sit amet malesuada quam enim vel |
| 40 |
odio. Nullam vitae feugiat sem. Suspendisse potenti. Mauris dolor enim, pretium a pulvinar ut, commodo |
| 41 |
at risus. |
| 42 |
</CardBody> |
| 43 |
</Card> |
| 44 |
</GalleryItem> |
| 45 |
))} |
| 46 |
</Gallery> |
| 47 |
</PageSection> |
| 48 |
<BackToTop scrollableSelector=".pf-v6-c-page__main-container" isAlwaysVisible={isAlwaysVisible} /> |
| 49 |
</DashboardWrapper> |
| 50 |
); |
| 51 |
}; |