-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PBNTR-550] Truncating the Typeahead FormPill text (#3738)
**What does this PR do?** Making Typeahead truncate global prop being applied to the FormPill text. #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. - [ ] **TESTS** I have added test coverage to my code. --------- Co-authored-by: Nida Ghuman <[email protected]>
- Loading branch information
1 parent
bb1461f
commit 4cf8451
Showing
9 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
playbook/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb
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,19 @@ | ||
<% | ||
names = [ | ||
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' }, | ||
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' }, | ||
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' }, | ||
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' }, | ||
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' }, | ||
] | ||
%> | ||
<%= pb_rails("typeahead", props: { | ||
html_options: { style: { maxWidth: "240px" }}, | ||
id: "typeahead-form-pill", | ||
is_multi: true, | ||
options: names, | ||
label: "Names", | ||
pills: true, | ||
truncate: 1, | ||
}) %> |
27 changes: 27 additions & 0 deletions
27
playbook/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx
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,27 @@ | ||
import React from 'react' | ||
import Typeahead from '../../pb_typeahead/_typeahead' | ||
|
||
const names = [ | ||
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' }, | ||
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' }, | ||
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' }, | ||
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' }, | ||
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' }, | ||
] | ||
|
||
const FormPillTruncatedText = (props) => { | ||
return ( | ||
<> | ||
<Typeahead | ||
htmlOptions={{ style: { maxWidth: "240px" }}} | ||
isMulti | ||
label="Names" | ||
options={names} | ||
truncate={1} | ||
{...props} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export default FormPillTruncatedText |
1 change: 1 addition & 0 deletions
1
playbook/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.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 @@ | ||
For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop. |
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
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
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