-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Truncate): Added the truncate component.
Updated build:watch to build css and perform transform. Updated with comments. Fixed broken tests. fixed broken tests. fixed broken tests. Fixed export. Updated with review comments. Updated examples.
- Loading branch information
Showing
14 changed files
with
1,785 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...s/content/extensions/component-groups/examples/ExpandableText/ExpandableText.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
section: extensions | ||
subsection: Component groups | ||
id: Expandable Text | ||
source: react | ||
propComponents: ['ExpandableText', 'ExpandableTextCustomButtonProps'] | ||
--- | ||
|
||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
## Component usage | ||
|
||
The **expandable text** component enables you to display long text to users via a tooltip. It builds off of the [tooltip component](https://www.patternfly.org/components/tooltip) to truncate UI text in an element and display the truncated text in a tooltip. | ||
|
||
### Basic ExpandableText component | ||
|
||
This is an example of a basic ExpandableText component. It will truncate the text and display the full text in a tooltip. The button will be display under the text and will toggle the text. | ||
|
||
```js file="./ExpandableTextExample.tsx" | ||
|
||
``` | ||
|
||
### ExpandableText component with inline text | ||
|
||
This is an example of a ExpandableText component with inline text. It will truncate the text and display the full text in a tooltip. The button will be display inline with the text and will toggle the text. | ||
|
||
```js file="./ExpandableTextInlineExample.tsx" | ||
|
||
``` | ||
|
||
### ExpandableText component with custom button text | ||
|
||
This is an example of a ExpandableText component with custom button text. It will truncate the text and display the full text in a tooltip. | ||
|
||
```js file="./ExpandableTextCustomButtonExample.tsx" | ||
|
||
``` | ||
|
||
### ExpandableText component with custom button | ||
|
||
This is an example of a ExpandableText component with a custom button. It will truncate the text and display the full text in a tooltip. | ||
|
||
```js file="./ExpandableTextCustomButtonExample.tsx" | ||
|
||
``` | ||
|
||
### ExpandableText component with no button | ||
|
||
This is an example of a ExpandableText component with no button. It will truncate the text and display the full text in a tooltip. The text will be displayed on hover. | ||
|
||
```js file="ExpandableTextNoButtonExample.tsx" | ||
|
||
``` |
15 changes: 15 additions & 0 deletions
15
...extensions/component-groups/examples/ExpandableText/ExpandableTextCustomButtonExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { Button } from '@patternfly/react-core'; | ||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore | ||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`; | ||
|
||
export const ExpandableTextCustomButtonExample: React.FunctionComponent = () => { | ||
const expandButton = <Button> Custom expand </Button> | ||
const collapseButton = <Button> Custom collapse </Button> | ||
return <ExpandableText text={text} customButton={{ expand: expandButton, collapse: collapseButton }} /> | ||
} |
10 changes: 10 additions & 0 deletions
10
...nsions/component-groups/examples/ExpandableText/ExpandableTextCustomLinkButtonExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore | ||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`; | ||
|
||
export const ExpandableTextLinkButtonExample: React.FunctionComponent = () => <ExpandableText text={text} inline={true} customButton={{ expand: "Custom expand", collapse: "Custom collapse" }} />; |
10 changes: 10 additions & 0 deletions
10
...ocs/content/extensions/component-groups/examples/ExpandableText/ExpandableTextExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore | ||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`; | ||
|
||
export const BasicExample: React.FunctionComponent = () => <ExpandableText text={text} length={10} />; |
10 changes: 10 additions & 0 deletions
10
...ntent/extensions/component-groups/examples/ExpandableText/ExpandableTextInlineExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore | ||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`; | ||
|
||
export const InlineExample: React.FunctionComponent = () => <ExpandableText text={text} length={10} inline={true} />; |
10 changes: 10 additions & 0 deletions
10
...ent/extensions/component-groups/examples/ExpandableText/ExpandableTextNoButtonExample.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ExpandableText from "@patternfly/react-component-groups/dist/dynamic/ExpandableText"; | ||
|
||
const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore | ||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`; | ||
|
||
export const ExpandableTextNoButtonExample: React.FunctionComponent = () => <ExpandableText data-testid="expandable-text-hover" length={50} inline={true} text={text} expandOnMouseOver hideExpandText />; |
Oops, something went wrong.