| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -16,6 +16,7 @@ import { | |
| DataListCell, | ||
| DataListCheck, | ||
| DataListAction, | ||
| DataListActionVisibility, | ||
| DataListToggle, | ||
| DataListContent, | ||
| Dropdown, | ||
| Expand All | @@ -24,6 +25,7 @@ import { | |
| DropdownItem | ||
| } from '@patternfly/react-core'; | ||
| import { CodeBranchIcon } from '@patternfly/react-icons'; | ||
| import { css } from '@patternfly/react-styles'; | ||
|
|
||
| ```js | ||
| import React from 'react'; | ||
| Expand Down Expand Up | @@ -97,15 +99,35 @@ import { | |
| class CheckboxActionDataList extends React.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { isOpen: false }; | ||
| this.state = { isOpen1: false, isOpen2: false, isOpen3: false }; | ||
|
|
||
| this.onToggle = isOpen => { | ||
| this.setState({ isOpen }); | ||
| this.onToggle1 = isOpen1 => { | ||
| this.setState({ isOpen1 }); | ||
| }; | ||
|
|
||
| this.onSelect = event => { | ||
| this.onSelect1 = event => { | ||
| this.setState(prevState => ({ | ||
| isOpen: !prevState.isOpen | ||
| isOpen1: !prevState.isOpen1 | ||
| })); | ||
| }; | ||
|
|
||
| this.onToggle2 = isOpen2 => { | ||
| this.setState({ isOpen2 }); | ||
| }; | ||
|
|
||
| this.onSelect2 = event => { | ||
| this.setState(prevState => ({ | ||
| isOpen2: !prevState.isOpen2 | ||
| })); | ||
| }; | ||
|
|
||
| this.onToggle3 = isOpen3 => { | ||
| this.setState({ isOpen3 }); | ||
| }; | ||
|
|
||
| this.onSelect3 = event => { | ||
| this.setState(prevState => ({ | ||
| isOpen3: !prevState.isOpen3 | ||
| })); | ||
| }; | ||
| } | ||
| Expand Down Expand Up | @@ -144,9 +166,9 @@ class CheckboxActionDataList extends React.Component { | |
| <Dropdown | ||
| isPlain | ||
| position={DropdownPosition.right} | ||
| isOpen={this.state.isOpen} | ||
| onSelect={this.onSelect} | ||
| toggle={<KebabToggle onToggle={this.onToggle} />} | ||
| isOpen={this.state.isOpen1} | ||
| onSelect={this.onSelect1} | ||
| toggle={<KebabToggle onToggle={this.onToggle1} />} | ||
| dropdownItems={[ | ||
| <DropdownItem key="link">Link</DropdownItem>, | ||
| <DropdownItem key="action" component="button"> | ||
| Expand Down Expand Up | @@ -175,6 +197,25 @@ class CheckboxActionDataList extends React.Component { | |
| ]} | ||
| /> | ||
| <DataListAction | ||
| className={css(DataListActionVisibility.hiddenOnLg)} | ||
| aria-labelledby="check-action-item2 check-action-action2" | ||
| id="check-action-action2" | ||
| aria-label="Actions" | ||
| > | ||
| <Dropdown | ||
| isPlain | ||
| position={DropdownPosition.right} | ||
| isOpen={this.state.isOpen2} | ||
| onSelect={this.onSelect2} | ||
| toggle={<KebabToggle onToggle={this.onToggle2} />} | ||
| dropdownItems={[ | ||
| <DropdownItem key="pri-action2" component="button">Primary</DropdownItem>, | ||
| <DropdownItem key="sec-action2" component="button">Secondary</DropdownItem>, | ||
| ]} | ||
| /> | ||
| </DataListAction> | ||
| <DataListAction | ||
| className={css(DataListActionVisibility.visibleOnLg, DataListActionVisibility.hidden)} | ||
| aria-labelledby="check-action-item2 check-action-action2" | ||
| id="check-action-action2" | ||
| aria-label="Actions" | ||
| Expand All | @@ -184,6 +225,53 @@ class CheckboxActionDataList extends React.Component { | |
| </DataListAction> | ||
| </DataListItemRow> | ||
| </DataListItem> | ||
| <DataListItem aria-labelledby="check-action-item3"> | ||
| <DataListItemRow> | ||
| <DataListCheck aria-labelledby="check-action-item3" name="check-action-check3" /> | ||
| <DataListItemCells | ||
| dataListCells={[ | ||
| <DataListCell key="primary content"> | ||
| <span id="check-action-item3">Primary content - Lorem ipsum</span> dolor sit amet, consectetur | ||
| adipisicing elit, sed do eiusmod. | ||
| </DataListCell>, | ||
| <DataListCell key="secondary content"> | ||
| Secondary content. Dolor sit amet, consectetur adipisicing elit, sed do eiusmod. | ||
| </DataListCell> | ||
| ]} | ||
| /> | ||
| <DataListAction | ||
| className={css(DataListActionVisibility.hiddenOnXl)} | ||
| aria-labelledby="check-action-item3 check-action-action3" | ||
| id="check-action-action3" | ||
| aria-label="Actions" | ||
| > | ||
| <Dropdown | ||
| isPlain | ||
| position={DropdownPosition.right} | ||
| isOpen={this.state.isOpen3} | ||
| onSelect={this.onSelect3} | ||
| toggle={<KebabToggle onToggle={this.onToggle3} />} | ||
| dropdownItems={[ | ||
| <DropdownItem key="pri-action3" component="button">Primary</DropdownItem>, | ||
| <DropdownItem key="sec1-action3" component="button">Secondary</DropdownItem>, | ||
| <DropdownItem key="sec2-action3" component="button">Secondary</DropdownItem>, | ||
| <DropdownItem key="sec3-action3" component="button">Secondary</DropdownItem>, | ||
| ]} | ||
| /> | ||
| </DataListAction> | ||
| <DataListAction | ||
| className={css(DataListActionVisibility.visibleOnXl, DataListActionVisibility.hidden)} | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe buttons are still visible when i reduce the screen width
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThanks. I will be looking into it. 😄
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityYep, I found the problem!
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI am just adding unit tests.
Sorry, something went wrong.
All reactions
|
||
| aria-labelledby="check-action-item3 check-action-action3" | ||
| id="check-action-action3" | ||
| aria-label="Actions" | ||
| > | ||
| <Button variant="primary">Primary</Button> | ||
| <Button variant="secondary">Secondary</Button> | ||
| <Button variant="secondary">Secondary</Button> | ||
| <Button variant="secondary">Secondary</Button> | ||
| </DataListAction> | ||
| </DataListItemRow> | ||
| </DataListItem> | ||
| </DataList> | ||
| ); | ||
| } | ||
| Expand Down Expand Up | @@ -566,7 +654,7 @@ import { | |
| class ModifiersDataList extends React.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { show: true, isOpen1: false, isOpen2: false }; | ||
| this.state = { show: true, isOpen1: false, isOpen2: false, isOpen3: false }; | ||
|
|
||
| this.onToggle1 = isOpen1 => { | ||
| this.setState({ isOpen1 }); | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,26 @@ | ||
| import * as React from 'react'; | ||
| import { css } from '@patternfly/react-styles'; | ||
| import { css, pickProperties } from '@patternfly/react-styles'; | ||
| import styles from '@patternfly/react-styles/css/components/DataList/data-list'; | ||
| import { Omit } from '../../helpers/typeUtils'; | ||
|
|
||
| const visibilityModifiers = pickProperties(styles.modifiers, [ | ||
| 'hidden', | ||
| 'hiddenOnSm', | ||
| 'hiddenOnMd', | ||
| 'hiddenOnLg', | ||
| 'hiddenOnXl', | ||
| 'hiddenOn_2xl', | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWorkaround looks good. Thanks as always @boaz0 ! 👍
Sorry, something went wrong.
boaz0 reacted with laugh emoji
All reactions
|
||
| 'visibleOnSm', | ||
| 'visibleOnMd', | ||
| 'visibleOnLg', | ||
| 'visibleOnXl', | ||
| 'visibleOn_2xl' | ||
| ]); | ||
|
|
||
| export const DataListActionVisibility = Object.keys(visibilityModifiers) | ||
| .map(key => [key.replace('_2xl', '2Xl'), visibilityModifiers[key]]) | ||
| .reduce((acc, curr) => ({ ...acc, [curr[0]]: curr[1] }), {}); | ||
|
|
||
| export interface DataListActionProps extends Omit<React.HTMLProps<HTMLDivElement>, 'children'> { | ||
| /** Content rendered as DataList Action (e.g <Button> or <Dropdown>) */ | ||
| children: React.ReactNode; | ||
| Expand All | @@ -22,8 +40,8 @@ interface DataListActionState { | |
|
|
||
| export class DataListAction extends React.Component<DataListActionProps, DataListActionState> { | ||
| static defaultProps = { | ||
| className: '', | ||
| } | ||
| className: '' | ||
| }; | ||
|
|
||
| constructor(props: DataListActionProps) { | ||
| super(props); | ||
| Expand Down Expand Up | @@ -53,10 +71,8 @@ export class DataListAction extends React.Component<DataListActionProps, DataLis | |
| } = this.props; | ||
|
|
||
| return ( | ||
| <div className={css(styles.dataListItemAction, className)}> | ||
| <div className={css(styles.dataListAction, className)} {...props}> | ||
| {children} | ||
| </div> | ||
| <div className={css(styles.dataListItemAction, className)} {...props}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| } | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.