From d235f0ab35125ec4eb852cc10125bc38c86c9f10 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Wed, 20 Apr 2022 16:44:18 -0400 Subject: [PATCH 01/13] add support for switching orientation at various breakpoints --- .../src/components/Divider/Divider.tsx | 10 ++++++++++ .../src/components/Divider/examples/Divider.md | 6 ++++++ .../DividerOrientationVariousBreakpoints.tsx | 17 +++++++++++++++++ ...viderVerticalFlexInsetVariousBreakpoints.tsx | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx diff --git a/packages/react-core/src/components/Divider/Divider.tsx b/packages/react-core/src/components/Divider/Divider.tsx index 321f5190835..431e6ad1a3d 100644 --- a/packages/react-core/src/components/Divider/Divider.tsx +++ b/packages/react-core/src/components/Divider/Divider.tsx @@ -25,6 +25,14 @@ export interface DividerProps extends React.HTMLProps { xl?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; '2xl'?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; }; + /** Indicates how the divider will display at various breakpoints. */ + orientation?: { + sm?: 'vertical' | 'horizontal'; + md?: 'vertical' | 'horizontal'; + lg?: 'vertical' | 'horizontal'; + xl?: 'vertical' | 'horizontal'; + '2xl'?: 'vertical' | 'horizontal'; + }; } export const Divider: React.FunctionComponent = ({ @@ -32,6 +40,7 @@ export const Divider: React.FunctionComponent = ({ component = DividerVariant.hr, isVertical = false, inset, + orientation, ...props }: DividerProps) => { const Component: any = component; @@ -42,6 +51,7 @@ export const Divider: React.FunctionComponent = ({ styles.divider, isVertical && styles.modifiers.vertical, formatBreakpointMods(inset, styles), + formatBreakpointMods(orientation, styles), className )} {...(component !== 'hr' && { role: 'separator' })} diff --git a/packages/react-core/src/components/Divider/examples/Divider.md b/packages/react-core/src/components/Divider/examples/Divider.md index 93cf361ae2a..6d9b86d78e4 100644 --- a/packages/react-core/src/components/Divider/examples/Divider.md +++ b/packages/react-core/src/components/Divider/examples/Divider.md @@ -46,3 +46,9 @@ propComponents: ['Divider'] ```ts file='./DividerVerticalFlexInsetVariousBreakpoints.tsx' ``` + +### Switch orientation at various breakpoints + +```ts file='./DividerOrientationVariousBreakpoints.tsx' +``` + diff --git a/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx b/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx new file mode 100644 index 00000000000..f6ff86b9cbc --- /dev/null +++ b/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import { Divider, Flex, FlexItem } from '@patternfly/react-core'; + +export const DividerOrientationVariousBreakpoints: React.FunctionComponent = () => ( + + first item + + second item + +); diff --git a/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx b/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx index e82d433546d..4a8ba25c7d3 100644 --- a/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx +++ b/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx @@ -13,6 +13,6 @@ export const DividerVerticalFlexInsetVariousBreakpoints: React.FunctionComponent xl: 'insetXs' }} /> - first item + second item ); From f3ddf80c986c50eafc619bf4b69ddbce7615feba Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Mon, 2 May 2022 10:18:53 -0400 Subject: [PATCH 02/13] fix isReversed checked state --- .../react-core/src/components/Switch/Switch.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/react-core/src/components/Switch/Switch.tsx b/packages/react-core/src/components/Switch/Switch.tsx index 88afbc66ef6..8651f03eada 100644 --- a/packages/react-core/src/components/Switch/Switch.tsx +++ b/packages/react-core/src/components/Switch/Switch.tsx @@ -91,7 +91,13 @@ export class Switch extends React.Component {label !== undefined ? ( - + + {hasCheckIcon && ( + + )} + {label} - {hasCheckIcon && ( - - )} + Date: Mon, 2 May 2022 10:35:40 -0400 Subject: [PATCH 03/13] update paths --- .../src/components/Divider/Divider.tsx | 10 ---------- .../src/components/Divider/examples/Divider.md | 6 ------ .../DividerOrientationVariousBreakpoints.tsx | 17 ----------------- ...viderVerticalFlexInsetVariousBreakpoints.tsx | 2 +- 4 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx diff --git a/packages/react-core/src/components/Divider/Divider.tsx b/packages/react-core/src/components/Divider/Divider.tsx index 431e6ad1a3d..321f5190835 100644 --- a/packages/react-core/src/components/Divider/Divider.tsx +++ b/packages/react-core/src/components/Divider/Divider.tsx @@ -25,14 +25,6 @@ export interface DividerProps extends React.HTMLProps { xl?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; '2xl'?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; }; - /** Indicates how the divider will display at various breakpoints. */ - orientation?: { - sm?: 'vertical' | 'horizontal'; - md?: 'vertical' | 'horizontal'; - lg?: 'vertical' | 'horizontal'; - xl?: 'vertical' | 'horizontal'; - '2xl'?: 'vertical' | 'horizontal'; - }; } export const Divider: React.FunctionComponent = ({ @@ -40,7 +32,6 @@ export const Divider: React.FunctionComponent = ({ component = DividerVariant.hr, isVertical = false, inset, - orientation, ...props }: DividerProps) => { const Component: any = component; @@ -51,7 +42,6 @@ export const Divider: React.FunctionComponent = ({ styles.divider, isVertical && styles.modifiers.vertical, formatBreakpointMods(inset, styles), - formatBreakpointMods(orientation, styles), className )} {...(component !== 'hr' && { role: 'separator' })} diff --git a/packages/react-core/src/components/Divider/examples/Divider.md b/packages/react-core/src/components/Divider/examples/Divider.md index 6d9b86d78e4..93cf361ae2a 100644 --- a/packages/react-core/src/components/Divider/examples/Divider.md +++ b/packages/react-core/src/components/Divider/examples/Divider.md @@ -46,9 +46,3 @@ propComponents: ['Divider'] ```ts file='./DividerVerticalFlexInsetVariousBreakpoints.tsx' ``` - -### Switch orientation at various breakpoints - -```ts file='./DividerOrientationVariousBreakpoints.tsx' -``` - diff --git a/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx b/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx deleted file mode 100644 index f6ff86b9cbc..00000000000 --- a/packages/react-core/src/components/Divider/examples/DividerOrientationVariousBreakpoints.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { Divider, Flex, FlexItem } from '@patternfly/react-core'; - -export const DividerOrientationVariousBreakpoints: React.FunctionComponent = () => ( - - first item - - second item - -); diff --git a/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx b/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx index 4a8ba25c7d3..e82d433546d 100644 --- a/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx +++ b/packages/react-core/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx @@ -13,6 +13,6 @@ export const DividerVerticalFlexInsetVariousBreakpoints: React.FunctionComponent xl: 'insetXs' }} /> - second item + first item ); From 55b190af3f40bcb29131eeb12c21947aae4e0a61 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Mon, 2 May 2022 10:40:55 -0400 Subject: [PATCH 04/13] remove whitespace --- packages/react-core/src/components/Switch/Switch.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-core/src/components/Switch/Switch.tsx b/packages/react-core/src/components/Switch/Switch.tsx index 8651f03eada..90c8ed474c2 100644 --- a/packages/react-core/src/components/Switch/Switch.tsx +++ b/packages/react-core/src/components/Switch/Switch.tsx @@ -105,7 +105,6 @@ export class Switch extends React.Component {label} - Date: Mon, 2 May 2022 15:04:57 -0400 Subject: [PATCH 05/13] add fullscreen compact example --- packages/react-table/src/demos/Table.md | 7 + .../src/demos/table-demos/Compact.jsx | 136 ++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 packages/react-table/src/demos/table-demos/Compact.jsx diff --git a/packages/react-table/src/demos/Table.md b/packages/react-table/src/demos/Table.md index 341692f5dd5..b07154c5a19 100644 --- a/packages/react-table/src/demos/Table.md +++ b/packages/react-table/src/demos/Table.md @@ -4,6 +4,7 @@ section: components --- import { Checkbox, ToolbarExpandIconWrapper, ToolbarContent } from '@patternfly/react-core'; +import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon'; import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon'; import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon'; import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon'; @@ -21,6 +22,7 @@ import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-ico import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon'; import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon'; +import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper'; ### Bulk select @@ -268,6 +270,11 @@ class BulkSelectTableDemo extends React.Component { ```js file="table-demos/ExpandCollapseAll.jsx" ``` +### Compact + +```js isFullscreen file="table-demos/Compact.jsx" +``` + ### Column management ```js diff --git a/packages/react-table/src/demos/table-demos/Compact.jsx b/packages/react-table/src/demos/table-demos/Compact.jsx new file mode 100644 index 00000000000..2af42377763 --- /dev/null +++ b/packages/react-table/src/demos/table-demos/Compact.jsx @@ -0,0 +1,136 @@ +import React from 'react'; +import { + Button, + Toolbar, + ToolbarContent, + ToolbarGroup, + ToolbarItem, + Pagination, + PaginationVariant, + Select, + SelectVariant, + SelectOption, + Page, + SkipToContent, + PageSection +} from '@patternfly/react-core'; +import { TableComposable, Thead, Tr, Th, Tbody, Td, ActionsColumn } from '@patternfly/react-table'; + +import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon'; +import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon'; +import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper'; + +export const ComposableTable = () => { + const [isSelectOpen, setIsSelectOpen] = React.useState(false); + + const columns = ['Contributor', 'Position', 'Location', 'Last seen', 'Numbers', 'Icons']; + const rows = [ + ['Sam Jones', 'CSS guru', 'Not too sure', 'May 9, 2018', '0556'], + ['Amy Miller', 'Visual design', 'Raleigh', 'May 9, 2018', '9492'], + ['Steve Wilson', 'Visual design lead', 'Westford', 'May 9, 2018', '9929'], + ['Emma Jackson', 'Interaction design', 'Westford', 'May 9, 2018', '2217'] + ]; + + const defaultActions = () => [ + { + title: 'Settings', + // eslint-disable-next-line no-console + onClick: () => console.log(`clicked on Settings`) + }, + { + title: 'Help', + // eslint-disable-next-line no-console + onClick: () => console.log(`clicked on Help`) + } + ]; + + const tableToolbar = ( + + + + + + + + + + + + + + + + ); + + return ( + + Skip to content} + mainContainerId={'main-content-page-layout-default-nav'} + > + + + {tableToolbar} + + + + {columns.map((column, columnIndex) => ( + {column} + ))} + + + + {rows.map((row, rowIndex) => ( + + <> + {row[0]} + {row[1]} + {row[2]} + {row[3]} + {row[4]} + + + + + Action link + + + + + + + ))} + + + + + + + ); +}; From 11492ed22258eef2f376b64dcb3101e70e515a81 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Mon, 2 May 2022 15:17:32 -0400 Subject: [PATCH 06/13] update paths --- .../react-core/src/components/Switch/Switch.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/react-core/src/components/Switch/Switch.tsx b/packages/react-core/src/components/Switch/Switch.tsx index 90c8ed474c2..88afbc66ef6 100644 --- a/packages/react-core/src/components/Switch/Switch.tsx +++ b/packages/react-core/src/components/Switch/Switch.tsx @@ -91,13 +91,7 @@ export class Switch extends React.Component {label !== undefined ? ( - - {hasCheckIcon && ( - - )} - + {label} + {hasCheckIcon && ( + + )} Date: Tue, 3 May 2022 16:11:55 -0400 Subject: [PATCH 07/13] fix id --- packages/react-table/src/demos/table-demos/Compact.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-table/src/demos/table-demos/Compact.jsx b/packages/react-table/src/demos/table-demos/Compact.jsx index 2af42377763..0cdf02b881a 100644 --- a/packages/react-table/src/demos/table-demos/Compact.jsx +++ b/packages/react-table/src/demos/table-demos/Compact.jsx @@ -45,7 +45,7 @@ export const ComposableTable = () => { ]; const tableToolbar = ( - + { - {tableToolbar} - - - - {columns.map((column, columnIndex) => ( - {column} - ))} - - - - {rows.map((row, rowIndex) => ( - - <> - {row[0]} - {row[1]} - {row[2]} - {row[3]} - {row[4]} - - - - - Action link - - - - - + + {tableToolbar} + + + + {columns.map((column, columnIndex) => ( + {column} + ))} - ))} - - - {renderPagination('bottom', false)} + + + {rows.map((row, rowIndex) => ( + + <> + {row[0]} + {row[1]} + {row[2]} + {row[3]} + {row[4]} + + + + + Action link + + + + + + + ))} + + + {renderPagination('bottom', false)} +