Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
- name: Install deps
run: yarn install --frozen-lockfile
- name: Build dist
run: yarn build && yarn build:umd && yarn clean:exports
run: yarn build && yarn build:umd
- name: Deploy to NPM and Github
run: .github/promote.sh
46 changes: 23 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -70,9 +70,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -110,9 +110,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -159,9 +159,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -219,9 +219,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -275,9 +275,9 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -319,7 +319,7 @@ jobs:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN_REDALLEN }} # needs to be an admin token to get around branch protection
fetch-depth: "0"
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-node@v1
with:
Expand All @@ -329,14 +329,14 @@ jobs:
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- name: Build dist
run: yarn build && yarn build:umd && yarn clean:exports
run: yarn build && yarn build:umd
if: steps.dist.outputs.cache-hit != 'true'
- name: Deploy to NPM and Github
run: .github/release.sh
2 changes: 0 additions & 2 deletions packages/react-core/src/demos/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './components';
export * from './demos';
export * from './layouts';
export * from './helpers';
export * from './styles';
198 changes: 198 additions & 0 deletions packages/react-table/src/demos/DashboardHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
import React, { useState } from 'react';
import {
Avatar,
Brand,
Button,
ButtonVariant,
Divider,
Dropdown,
DropdownGroup,
DropdownItem,
DropdownList,
Masthead,
MastheadToggle,
MastheadMain,
MastheadBrand,
MastheadContent,
MenuToggle,
Toolbar,
ToolbarContent,
ToolbarGroup,
ToolbarItem,
PageToggleButton
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
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-table/src/demos/assets/avatarImg.svg';
import pfLogo from '@patternfly/react-table/src/demos/assets/pf-logo.svg';

interface DashboardHeaderProps {
/** Render custom notification badge */
notificationBadge?: React.ReactNode;
}

export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBadge }) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [isKebabDropdownOpen, setIsKebabDropdownOpen] = useState(false);
const [isFullKebabDropdownOpen, setIsFullKebabDropdownOpen] = useState(false);

const kebabDropdownItems = (
<>
<DropdownItem>
<CogIcon /> Settings
</DropdownItem>
<DropdownItem>
<HelpIcon /> Help
</DropdownItem>
</>
);

const userDropdownItems = (
<>
<DropdownItem key="group 2 profile">My profile</DropdownItem>
<DropdownItem key="group 2 user">User management</DropdownItem>
<DropdownItem key="group 2 logout">Logout</DropdownItem>
</>
);

const onDropdownToggle = () => {
setIsDropdownOpen(!isDropdownOpen);
};

const onDropdownSelect = () => {
setIsDropdownOpen(false);
};

const onKebabDropdownToggle = () => {
setIsKebabDropdownOpen(!isKebabDropdownOpen);
};

const onKebabDropdownSelect = () => {
setIsKebabDropdownOpen(false);
};

const onFullKebabToggle = () => {
setIsFullKebabDropdownOpen(!isFullKebabDropdownOpen);
};

const onFullKebabSelect = () => {
setIsFullKebabDropdownOpen(false);
};

return (
<Masthead>
<MastheadToggle>
<PageToggleButton variant="plain" aria-label="Global navigation">
<BarsIcon />
</PageToggleButton>
</MastheadToggle>
<MastheadMain>
<MastheadBrand>
<Brand src={pfLogo} alt="PatternFly" heights={{ default: '36px' }} />
</MastheadBrand>
</MastheadMain>
<MastheadContent>
<Toolbar id="toolbar" isFullHeight isStatic>
<ToolbarContent>
<ToolbarGroup
variant="icon-button-group"
align={{ default: 'alignRight' }}
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
>
{notificationBadge ?? (
<ToolbarItem>
<Button
aria-label="Notifications"
variant={ButtonVariant.plain}
icon={<BellIcon />}
onClick={() => {}}
/>
</ToolbarItem>
)}
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
<ToolbarItem>
<Button aria-label="Settings" variant={ButtonVariant.plain} icon={<CogIcon />} />
</ToolbarItem>
<ToolbarItem>
<Button aria-label="Help" variant={ButtonVariant.plain} icon={<QuestionCircleIcon />} />
</ToolbarItem>
</ToolbarGroup>
<ToolbarItem visibility={{ default: 'hidden', md: 'visible', lg: 'hidden' }}>
<Dropdown
isOpen={isKebabDropdownOpen}
onSelect={onKebabDropdownSelect}
onOpenChange={setIsKebabDropdownOpen}
popperProps={{ position: 'right' }}
toggle={(toggleRef: React.RefObject<any>) => (
<MenuToggle
ref={toggleRef}
isExpanded={isKebabDropdownOpen}
onClick={onKebabDropdownToggle}
variant="plain"
aria-label="Settings and help"
>
<EllipsisVIcon aria-hidden="true" />
</MenuToggle>
)}
>
<DropdownList>{kebabDropdownItems}</DropdownList>
</Dropdown>
</ToolbarItem>
<ToolbarItem visibility={{ md: 'hidden' }}>
<Dropdown
isOpen={isFullKebabDropdownOpen}
onSelect={onFullKebabSelect}
onOpenChange={setIsFullKebabDropdownOpen}
popperProps={{ position: 'right' }}
toggle={(toggleRef: React.RefObject<any>) => (
<MenuToggle
ref={toggleRef}
isExpanded={isFullKebabDropdownOpen}
onClick={onFullKebabToggle}
variant="plain"
aria-label="Toolbar menu"
>
<EllipsisVIcon aria-hidden="true" />
</MenuToggle>
)}
>
<DropdownGroup key="group 2" aria-label="User actions">
<DropdownList>{userDropdownItems}</DropdownList>
</DropdownGroup>
<Divider />
<DropdownList>{kebabDropdownItems}</DropdownList>
</Dropdown>
</ToolbarItem>
</ToolbarGroup>
<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
<Dropdown
isOpen={isDropdownOpen}
onSelect={onDropdownSelect}
onOpenChange={setIsDropdownOpen}
popperProps={{ position: 'right' }}
toggle={(toggleRef: React.RefObject<any>) => (
<MenuToggle
ref={toggleRef}
isExpanded={isDropdownOpen}
onClick={onDropdownToggle}
icon={<Avatar src={imgAvatar} alt="" />}
isFullHeight
>
Ned Username
</MenuToggle>
)}
>
<DropdownList>{userDropdownItems}</DropdownList>
</Dropdown>
</ToolbarItem>
</ToolbarContent>
</Toolbar>
</MastheadContent>
</Masthead>
);
};
DashboardHeader.displayName = 'DashboardHeader';
Loading