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

fix(build): update to PF6 betas #228

Merged
merged 1 commit into from
Aug 6, 2024
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
6 changes: 3 additions & 3 deletions packages/demo-app-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"serve:demo-app": "node scripts/serve"
},
"dependencies": {
"@patternfly/react-core": "6.0.0-alpha.70",
"@patternfly/react-icons": "6.0.0-alpha.24",
"@patternfly/react-styles": "6.0.0-alpha.24",
"@patternfly/react-core": "6.0.0-alpha.94",
"@patternfly/react-icons": "6.0.0-alpha.34",
"@patternfly/react-styles": "6.0.0-alpha.33",
"react": "^18",
"react-dom": "^18",
"react-router": "^5.3.3",
Expand Down
37 changes: 21 additions & 16 deletions packages/demo-app-ts/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ class App extends React.Component<{}, AppState> {
<Route
path={`/${demo.id}-nav-link/${subDemo.id}-nav-link`}
render={() => (
<PageSection style={{ zIndex: 2 }} id={`/${demo.id}-nav-link/${subDemo.id}-nav-link`}>
<PageSection
isFilled
hasBodyWrapper={false}
style={{ zIndex: 2 }}
id={`/${demo.id}-nav-link/${subDemo.id}-nav-link`}
>
{React.createElement(subDemo.componentType)}
</PageSection>
)}
Expand All @@ -87,7 +92,7 @@ class App extends React.Component<{}, AppState> {
<Route
path={`/${demo.id}-nav-link`}
render={() => (
<PageSection style={{ zIndex: 2 }} id={`/${demo.id}-page-section`}>
<PageSection isFilled hasBodyWrapper={false} style={{ zIndex: 2 }} id={`/${demo.id}-page-section`}>
{React.createElement(demo.componentType)}
</PageSection>
)}
Expand All @@ -101,7 +106,7 @@ class App extends React.Component<{}, AppState> {
<Route
path="/"
render={() => (
<PageSection style={{ zIndex: 2 }} id={`/${defaultDemo.id}-page-section`}>
<PageSection isFilled hasBodyWrapper={false} style={{ zIndex: 2 }} id={`/${defaultDemo.id}-page-section`}>
{React.createElement(defaultDemo.componentType)}
</PageSection>
)}
Expand Down Expand Up @@ -151,19 +156,19 @@ class App extends React.Component<{}, AppState> {

const AppHeader = (
<Masthead>
<MastheadToggle>
<PageToggleButton
variant="plain"
aria-label="Global navigation"
isSidebarOpen={isNavOpen}
onSidebarToggle={() => this.setState({ isNavOpen: !isNavOpen })}
>
<BarsIcon />
</PageToggleButton>
</MastheadToggle>
<MastheadMain>
<MastheadBrand component="a">
<Brand src={imgBrand} alt="Patternfly Logo" heights={{ default: '36px' }} />
<MastheadToggle>
<PageToggleButton
variant="plain"
aria-label="Global navigation"
isSidebarOpen={isNavOpen}
onSidebarToggle={() => this.setState({ isNavOpen: !isNavOpen })}
>
<BarsIcon />
</PageToggleButton>
</MastheadToggle>
<MastheadBrand>
<Brand src={imgBrand} alt="Patternfly Logo" heights={{ default: '40px' }} />
</MastheadBrand>
</MastheadMain>
<MastheadContent>{AppToolbar}</MastheadContent>
Expand Down Expand Up @@ -207,7 +212,7 @@ class App extends React.Component<{}, AppState> {

return (
<Router>
<Page masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar mainContainerId={this.pageId}>
<Page isContentFilled masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar mainContainerId={this.pageId}>
{this.getPages()}
</Page>
</Router>
Expand Down
20 changes: 10 additions & 10 deletions packages/demo-app-ts/src/Demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
}

.pf-ri__topology-demo .pf-topology-visualization-surface {
border: 1px solid var(--pf-t--global--border--color--100);
border-top: none;
border: 1px solid var(--pf-t--global--border--color--default);
}

.pf-ri__topology-demo .pf-v6-c-tab-content {
Expand All @@ -23,6 +22,7 @@
.pf-ri__topology-demo .pf-v6-c-toolbar {
--pf-v6-c-toolbar__expandable-content--lg--PaddingBottom: 0;
--pf-v6-c-toolbar--PaddingBottom: 0;
--pf-v6-c-toolbar--PaddingBlockStart: var(--pf-t--global--spacer--300);
Copy link
Contributor

@nicolethoen nicolethoen Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some references to base tokens in this CSS. Ideally we would use semantic tokens without --300 or other numbers at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nicolethoen ! Updated to use semantic tokens with the exception of --pf-t--color--red--50 , which I couldn't find referenced with any semantic tokens in https://github.com/patternfly/patternfly/blob/v6/src/patternfly/base/tokens

}
.pf-ri__topology-demo .pf-v6-c-toolbar__item .pf-v6-l-flex {
--pf-v6-l-flex--FlexWrap: no-wrap;
Expand All @@ -42,21 +42,21 @@
}

.pf-ri-topology__node__background {
fill: var(--pf-t--color--gray--40);
stroke-width: 1px;
stroke: var(--pf-t--color--black);
fill: var(--pf-t--global--background--color--floating--default);
stroke-width: var(--pf-t--global--border--width--regular);
stroke: var(--pf-t--global--border--color--default);
}

.pf-ri-topology__node__background.pf-m-selected {
fill: var(--pf-t--color--blue--50);
fill: var(--pf-t--global--color--brand--default);
}

.pf-ri-topology__node__background.pf-m-hover {
fill: var(--pf-t--color--green--40);
fill: var(--pf-t--global--border--color--nonstatus--green--hover);
}

.pf-ri-topology__node__background.pf-m-drop-target {
fill: var(--pf-t--color--blue--20);
fill: var(--pf-t--global--color--nonstatus--blue--default);
}

.pf-v6-c-page__main-section#\/topology-demo-page-section,
Expand All @@ -72,9 +72,9 @@
fill: var(--pf-t--color--red--50);
}
.topology-demo-badge > text {
fill: var(--pf-t--global--color--nonstatus--gold--200);
fill: var(--pf-t--global--text--color--inverse);
}

.pf-v6-c-toolbar__content.pf-m-hidden {
display: none;
}
}
29 changes: 28 additions & 1 deletion packages/demo-app-ts/src/assets/images/imgBrand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Radio, Text, ToolbarItem } from '@patternfly/react-core';
import { Radio, Content, ToolbarItem } from '@patternfly/react-core';
import { observer } from '@patternfly/react-topology';
import { PipelineGroupsDemoContext } from './PipelineGroupsDemoContext';

Expand All @@ -9,7 +9,7 @@ const OptionsBar: React.FC = observer(() => {
return (
<>
<ToolbarItem>
<Text className="pf-u-mr-sm">Layout:</Text>
<Content className="pf-u-mr-sm">Layout:</Content>
</ToolbarItem>
<ToolbarItem>
<Radio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import {
DropdownItem,
DropdownList,
Flex,
FlexItem,
MenuToggle,
MenuToggleElement,
Split,
SplitItem,
TextInput,
ToolbarItem,
Tooltip
Expand All @@ -29,11 +28,11 @@ const OptionsContextBar: React.FC<{ controller: Controller }> = observer(({ cont
};

const layoutDropdown = (
<Split>
<SplitItem>
<Flex flexWrap={{ default: 'nowrap' }} gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}>
<FlexItem>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you don't have a flex layouts in the toolbar at all?

you could use:

<ToolbarItem variant='label'>Layout:</ToolbarItem>
<ToolbarItem'><Dropdown.../></ToolbarItem>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on refactoring these instances where we use Flex layouts to use the syntax above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I used a single ToolbarItem with a Flex for the label and input was so that the label and input would look more related (less space between them than between the input and the next label). Also, if the widow width is less, the new implementation cuts off the items rather than wrapping.

Before:
image

After:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying @jeff-phillips-18 , reverted back to your changes in jenny-s51#11

<label className="pf-v6-u-display-inline-block pf-v6-u-mr-md pf-v6-u-mt-sm">Layout:</label>
</SplitItem>
<SplitItem>
</FlexItem>
<FlexItem>
<Dropdown
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={() => setLayoutDropdownOpen(!layoutDropdownOpen)}>
Expand Down Expand Up @@ -70,8 +69,8 @@ const OptionsContextBar: React.FC<{ controller: Controller }> = observer(({ cont
</DropdownItem>
</DropdownList>
</Dropdown>
</SplitItem>
</Split>
</FlexItem>
</Flex>
);

const saveModel = () => {
Expand Down Expand Up @@ -135,7 +134,7 @@ const OptionsContextBar: React.FC<{ controller: Controller }> = observer(({ cont
};

return (
<Flex flexWrap={{ default: 'wrap' }} gap={{ default: 'gapMd' }}>
<Flex flexWrap={{ default: 'wrap' }} gap={{ default: 'gapMd' }} alignItems={{ default: 'alignItemsCenter' }}>
jenny-s51 marked this conversation as resolved.
Show resolved Hide resolved
<Flex>
<ToolbarItem>{layoutDropdown}</ToolbarItem>
<ToolbarItem>
Expand Down
14 changes: 7 additions & 7 deletions packages/module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"tag": "alpha"
},
"dependencies": {
"@patternfly/react-core": "6.0.0-alpha.70",
"@patternfly/react-icons": "6.0.0-alpha.24",
"@patternfly/react-styles": "6.0.0-alpha.24",
"@patternfly/react-core": "6.0.0-alpha.94",
"@patternfly/react-icons": "6.0.0-alpha.34",
"@patternfly/react-styles": "6.0.0-alpha.33",
"@types/d3": "^7.4.0",
"@types/d3-force": "^1.2.1",
"@types/react-measure": "^2.0.6",
Expand All @@ -54,11 +54,11 @@
"react-dom": "^17 || ^18"
},
"devDependencies": {
"@patternfly/documentation-framework": "6.0.0-alpha.50",
"@patternfly/patternfly": "6.0.0-alpha.167",
"@patternfly/documentation-framework": "6.0.0-alpha.69",
"@patternfly/patternfly": "6.0.0-alpha.205",
"@patternfly/patternfly-a11y": "^4.3.1",
"@patternfly/react-code-editor": "6.0.0-alpha.70",
"@patternfly/react-table": "6.0.0-alpha.71",
"@patternfly/react-code-editor": "6.0.0-alpha.94",
"@patternfly/react-table": "6.0.0-alpha.95",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"camel-case": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
DropdownList,
MenuToggle,
MenuToggleElement,
Split,
SplitItem,
ToolbarItem
} from '@patternfly/react-core';
// eslint-disable-next-line patternfly-react/import-tokens-icons
Expand Down Expand Up @@ -257,11 +255,9 @@ export const LayoutsDemo: React.FC = () => {
}, [controller, layout]);

const layoutDropdown = (
<Split>
<SplitItem>
<label className="pf-v6-u-display-inline-block pf-v6-u-mr-md pf-v6-u-mt-sm">Layout</label>
</SplitItem>
<SplitItem>
<>
<ToolbarItem variant="label">Layout</ToolbarItem>
<ToolbarItem>
<Dropdown
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={() => setLayoutDropdownOpen(!layoutDropdownOpen)}>
Expand Down Expand Up @@ -317,8 +313,8 @@ export const LayoutsDemo: React.FC = () => {
</DropdownItem>
</DropdownList>
</Dropdown>
</SplitItem>
</Split>
</ToolbarItem>
</>
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export const TopologyControlBar: React.FunctionComponent<TopologyControlBarProps
return (
<GenerateId prefix="pf-topology-control-bar-">
{(randomId) => (
<Toolbar className={className} style={{ backgroundColor: 'transparent', padding: 0 }} id={randomId}>
<Toolbar className={className} style={{ backgroundColor: 'transparent' }} id={randomId}>
<ToolbarContent>
<ToolbarGroup gap={{ default: 'gapNone' }}>
{controlButtons.map((button: TopologyControlButton) =>
Expand Down
Loading
Loading