-
Notifications
You must be signed in to change notification settings - Fork 380
feat(Wizard): added plain styling #12289
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
base: main
Are you sure you want to change the base?
Changes from all commits
8261457
4f85c37
34b4cb1
31f5f63
c8a8f74
aeaf892
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,10 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> { | |
| * are called. | ||
| */ | ||
| shouldFocusContent?: boolean; | ||
| /** Adds plain styling to the wizard. */ | ||
| isPlain?: boolean; | ||
|
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. Just curious - why is
Contributor
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. We probably could make both beta; I think at least having the isNo... prop as beta gives us an easier means to remove the prop if needed down the line (without having to deprecate then wait for a breaking release) |
||
| /** @beta Prevents the wizard from automatically applying plain styling when glass theme is enabled. When both this and isPlain are true, isPlain takes precedence. */ | ||
| isNoPlainOnGlass?: boolean; | ||
| } | ||
|
|
||
| export const Wizard = ({ | ||
|
|
@@ -77,8 +81,17 @@ export const Wizard = ({ | |
| onSave, | ||
| onClose, | ||
| shouldFocusContent = true, | ||
| isPlain = false, | ||
| isNoPlainOnGlass = false, | ||
| ...wrapperProps | ||
| }: WizardProps) => { | ||
| if (isPlain && isNoPlainOnGlass) { | ||
| // eslint-disable-next-line no-console | ||
| console.warn( | ||
| `Wizard: When both isPlain and isNoPlainOnGlass are true, isPlain will take precedence and isNoPlainOnGlass will have no effect. It's recommended to pass only one prop according to the current theme.` | ||
| ); | ||
| } | ||
|
|
||
| const [activeStepIndex, setActiveStepIndex] = useState(startIndex); | ||
| const initialSteps = buildSteps(children); | ||
| const firstStepRef = useRef(initialSteps[startIndex - 1]); | ||
|
|
@@ -181,7 +194,12 @@ export const Wizard = ({ | |
| mainWrapperRef={wrapperRef} | ||
| > | ||
| <div | ||
| className={css(styles.wizard, className)} | ||
| className={css( | ||
| styles.wizard, | ||
| isPlain && styles.modifiers.plain, | ||
| isNoPlainOnGlass && styles.modifiers.noPlainOnGlass, | ||
| className | ||
| )} | ||
| style={{ | ||
| ...(height ? { [wizardHeightToken.name]: typeof height === 'number' ? `${height}px` : height } : {}), | ||
| ...(width ? { width } : {}) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Wizard, WizardStep } from '@patternfly/react-core'; | ||
|
|
||
| export const WizardPlain: React.FunctionComponent = () => ( | ||
| <Wizard height={400} title="Plain wizard" isPlain> | ||
| <WizardStep name="Step 1" id="plain-first-step"> | ||
| <p>Step 1 content</p> | ||
| </WizardStep> | ||
| <WizardStep name="Step 2" id="plain-second-step"> | ||
| <p>Step 2 content</p> | ||
| </WizardStep> | ||
| <WizardStep name="Review" id="plain-review-step" footer={{ nextButtonText: 'Finish' }}> | ||
| <p>Review step content</p> | ||
| </WizardStep> | ||
| </Wizard> | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, does this prop do nothing? Or are style changes applied with
pf-m-plain. I ask because it is hard coded below so I am assuming it has no styles associated with it.If the prop does not do anything, do we need to add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prop will dictate whether the
pf-m-plainclass is applied