-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wizard): allow long page titles to wrap in stepnav (#1211)
## PR Checklist Please check if your PR fulfills the following requirements: - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) - [x] If applicable, have a visual design approval ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x". --> - [x] Bugfix - [ ] Feature - [ ] Code style update (formatting, local variables) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] CI related changes - [ ] Documentation content changes - [ ] Other... Please describe: ## What is the current behavior? Longer page titles in the wizard do not wrap, resulting in some text being hidden. Longer text strings are necessary for internationalization, as relative short titles in english can become much longer in other languages. Issue Number: CDE-1648, CDE-1645 ## What is the new behavior? Longer page titles will wrap when listed in the step nav. ## Does this PR introduce a breaking change? - [ ] Yes - [x] No <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information --------- Co-authored-by: GitHub <[email protected]>
- Loading branch information
1 parent
25155bf
commit dc52751
Showing
12 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
111 changes: 111 additions & 0 deletions
111
.storybook/stories/wizard/wizard-long-titles.stories.ts
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,111 @@ | ||
/* | ||
* Copyright (c) 2016-2023 VMware, Inc. All Rights Reserved. | ||
* This software is released under MIT license. | ||
* The full license information can be found in LICENSE in the root directory of this project. | ||
*/ | ||
|
||
import { ClrWizard, ClrWizardModule, commonStringsDefault } from '@clr/angular'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { Parameters } from '@storybook/addons'; | ||
import { Story } from '@storybook/angular'; | ||
|
||
import { setupStorybook } from '../../helpers/setup-storybook.helpers'; | ||
|
||
const defaultStory: Story = args => ({ | ||
template: ` | ||
<clr-wizard | ||
[clrWizardOpen]="clrWizardOpen" | ||
[clrWizardClosable]="clrWizardClosable" | ||
[clrWizardDisableStepnav]="clrWizardDisableStepnav" | ||
[clrWizardPreventNavigation]="clrWizardPreventNavigation" | ||
[clrWizardForceForwardNavigation]="clrWizardForceForwardNavigation" | ||
[clrWizardPreventDefaultNext]="clrWizardPreventDefaultNext" | ||
[clrWizardPreventDefaultCancel]="clrWizardPreventDefaultCancel" | ||
[clrWizardPreventModalAnimation]="clrWizardPreventModalAnimation" | ||
[clrWizardSize]="clrWizardSize" | ||
[clrWizardStepnavAriaLabel]="clrWizardStepnavAriaLabel" | ||
(clrWizardOpenChange)="clrWizardOpenChange($event)" | ||
(clrWizardCurrentPageChanged)="clrWizardCurrentPageChanged($event)" | ||
(clrWizardOnNext)="clrWizardOnNext($event)" | ||
(clrWizardOnPrevious)="clrWizardOnPrevious($event)" | ||
(clrWizardOnCancel)="clrWizardOnCancel($event)" | ||
(clrWizardOnFinish)="clrWizardOnFinish($event)" | ||
(clrWizardOnReset)="clrWizardOnReset($event)" | ||
> | ||
<clr-wizard-title [clrHeadingLevel]="clrHeadingLevel">Wizard</clr-wizard-title> | ||
<clr-wizard-button type="cancel">Cancel</clr-wizard-button> | ||
<clr-wizard-button type="previous">Previous</clr-wizard-button> | ||
<clr-wizard-button type="next">Next</clr-wizard-button> | ||
<clr-wizard-button type="finish">Finish</clr-wizard-button> | ||
<clr-wizard-page *ngFor="let _ of createArray(pageCount); let i = index"> | ||
<ng-template clrPageTitle>{{ useLongPageTitles ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua' : '' }} Page {{ i + 1 }}</ng-template> | ||
<p>Content for page {{ i + 1 }}.</p> | ||
</clr-wizard-page> | ||
</clr-wizard> | ||
`, | ||
props: { ...args }, | ||
}); | ||
|
||
const defaultParameters: Parameters = { | ||
title: 'Wizard/Wizard Long Titles', | ||
component: ClrWizard, | ||
argTypes: { | ||
// inputs | ||
clrHeadingLevel: { defaultValue: 1, control: { type: 'number', min: 1, max: 6 } }, | ||
clrWizardOpen: { defaultValue: true }, // the default value is really false, but that doesn't really work for the story | ||
clrWizardClosable: { defaultValue: true }, | ||
clrWizardDisableStepnav: { defaultValue: false }, | ||
clrWizardPreventNavigation: { defaultValue: false }, | ||
clrWizardForceForwardNavigation: { defaultValue: false }, | ||
clrWizardPreventDefaultNext: { defaultValue: false }, | ||
clrWizardPreventDefaultCancel: { defaultValue: false }, | ||
clrWizardPreventModalAnimation: { defaultValue: false }, | ||
clrWizardStepnavAriaLabel: { defaultValue: commonStringsDefault.wizardStepnavAriaLabel }, | ||
clrWizardSize: { defaultValue: 'xl', control: { type: 'inline-radio', options: ['sm', 'md', 'lg', 'xl'] } }, | ||
// outputs | ||
clrWizardOpenChange: { control: { disable: true } }, | ||
clrWizardCurrentPageChanged: { control: { disable: true } }, | ||
clrWizardOnNext: { control: { disable: true } }, | ||
clrWizardOnPrevious: { control: { disable: true } }, | ||
clrWizardOnCancel: { control: { disable: true } }, | ||
clrWizardOnFinish: { control: { disable: true } }, | ||
clrWizardOnReset: { control: { disable: true } }, | ||
// methods | ||
cancel: { control: { disable: true } }, | ||
checkAndCancel: { control: { disable: true } }, | ||
close: { control: { disable: true } }, | ||
finish: { control: { disable: true } }, | ||
forceFinish: { control: { disable: true } }, | ||
forceNext: { control: { disable: true } }, | ||
goTo: { control: { disable: true } }, | ||
modalCancel: { control: { disable: true }, table: { disable: true } }, | ||
next: { control: { disable: true } }, | ||
open: { control: { disable: true } }, | ||
previous: { control: { disable: true } }, | ||
reset: { control: { disable: true } }, | ||
toggle: { control: { disable: true } }, | ||
// story helpers | ||
createArray: { control: { disable: true }, table: { disable: true } }, | ||
pageCount: { control: { type: 'number', min: 1, max: 100 } }, | ||
}, | ||
args: { | ||
// outputs | ||
clrWizardOpenChange: action('clrWizardOpenChange'), | ||
clrWizardCurrentPageChanged: action('clrWizardCurrentPageChanged'), | ||
clrWizardOnNext: action('clrWizardOnNext'), | ||
clrWizardOnPrevious: action('clrWizardOnPrevious'), | ||
clrWizardOnCancel: action('clrWizardOnCancel'), | ||
clrWizardOnFinish: action('clrWizardOnFinish'), | ||
clrWizardOnReset: action('clrWizardOnFinish'), | ||
// story helpers | ||
createArray: n => new Array(n), | ||
pageCount: 4, | ||
useLongPageTitles: true, | ||
}, | ||
}; | ||
|
||
const variants: Parameters[] = []; | ||
|
||
setupStorybook(ClrWizardModule, defaultStory, defaultParameters, variants); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.