Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Masthead): Consume Penta tokens #9853

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 8 additions & 146 deletions packages/react-core/src/components/Masthead/examples/Masthead.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ propComponents: ['Masthead', 'MastheadToggle', 'MastheadMain', 'MastheadBrand',

import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
import { Link } from '@reach/router';
import pfIcon from '../../assets/pf-logo.svg';
import pfIcon from '../../assets/PF-HorizontalLogo-Color.svg';

`Masthead` should contain the following components to maintain proper layout and formatting: `MastheadToggle`, `MastheadMain`, and `MastheadContent`.

Expand All @@ -17,173 +17,35 @@ import pfIcon from '../../assets/pf-logo.svg';

### Basic

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="basic-example">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadBasic.tsx"
```

### Basic with mixed content

```ts
import React from 'react';
import {
Masthead,
MastheadToggle,
MastheadMain,
MastheadBrand,
MastheadContent,
Button,
Flex,
FlexItem
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="basic-mixed">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<Flex>
<span>Testing text color</span>
<Button>testing</Button>
<FlexItem alignSelf={{ default: 'alignSelfFlexEnd' }}>
<Button>testing</Button>
</FlexItem>
</Flex>
</MastheadContent>
</Masthead>;
```ts file="./MastheadBasicMixedContent.tsx"
```

### Display inline

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="inline-masthead" display={{ default: 'inline' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadDisplayInline.tsx"
```

### Display stack

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="stack-masthead" display={{ default: 'stack' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadDisplayStack.tsx"
```

### Display stack, display inline responsive

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="stack-inline-masthead" display={{ default: 'inline', lg: 'stack', '2xl': 'inline' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadDisplayStackInlineResponsive.tsx"
```

### Inset

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

<Masthead id="inset-masthead" inset={{ default: 'insetSm' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadInsets.tsx"
```

### With icon router link

```ts
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button, Brand } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
import { Link } from '@reach/router';
import pfIcon from '../../assets/pf-logo.svg';

<Masthead id="icon-router-link">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component={props => <Link {...props} to="#" />}>
<Brand src={pfIcon} alt="PatternFly" heights={{ default: '36px' }} />
</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>;
```ts file="./MastheadIconRouterLink.tsx"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadBasic: React.FunctionComponent = () => (
<Masthead id="basic-example">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import {
Masthead,
MastheadToggle,
MastheadMain,
MastheadBrand,
MastheadContent,
Button,
Flex,
FlexItem
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadBasicMixedContent: React.FunctionComponent = () => (
<Masthead id="basic-mixed">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<Flex>
<span>Content</span>
<Button>Primary</Button>
<FlexItem alignSelf={{ default: 'alignSelfFlexEnd' }}>
<Button variant="secondary">Secondary</Button>
</FlexItem>
<FlexItem alignSelf={{ default: 'alignSelfFlexEnd' }}>
<Button variant="tertiary">Tertiary</Button>
</FlexItem>
</Flex>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadDisplayInline: React.FunctionComponent = () => (
<Masthead id="inline-masthead" display={{ default: 'inline' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadDisplayStack: React.FunctionComponent = () => (
<Masthead id="stack-masthead" display={{ default: 'stack' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadDisplayStackInlineResponsive: React.FunctionComponent = () => (
<Masthead id="stack-inline-masthead" display={{ default: 'inline', lg: 'stack', '2xl': 'inline' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import {
Masthead,
MastheadToggle,
MastheadMain,
MastheadBrand,
MastheadContent,
Button,
Brand
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
import { Link } from '@reach/router';
import pfIcon from '../../assets/PF-HorizontalLogo-Color.svg';

export const MastheadIconRouterLink: React.FunctionComponent = () => (
<Masthead id="icon-router-link">
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component={(props) => <Link {...props} to="#" />}>
<Brand src={pfIcon} alt="PatternFly" heights={{ default: '36px' }} />
mattnolting marked this conversation as resolved.
Show resolved Hide resolved
</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Masthead, MastheadToggle, MastheadMain, MastheadBrand, MastheadContent, Button } from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';

export const MastheadInsets: React.FunctionComponent = () => (
<Masthead id="inset-masthead" inset={{ default: 'insetSm' }}>
<MastheadToggle>
<Button variant="plain" onClick={() => {}} aria-label="Global navigation">
<BarsIcon />
</Button>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">Logo</MastheadBrand>
</MastheadMain>
<MastheadContent>
<span>Content</span>
</MastheadContent>
</Masthead>
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/react-core/src/demos/DashboardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';
import pfLogo from '@patternfly/react-core/src/demos/assets/pf-logo.svg';
import pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';

interface DashboardHeaderProps {
/** Render custom notification badge */
Expand Down
Loading
Loading