-
Notifications
You must be signed in to change notification settings - Fork 392
chore(docs): Replace ActionGroup with ActionList #12589
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
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 |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ export interface FormGroupProps extends Omit<React.HTMLProps<HTMLDivElement>, 'l | |
| isInline?: boolean; | ||
| /** Sets the FormGroupControl to be stacked */ | ||
| isStack?: boolean; | ||
| /** Sets the FormGroup action modifier. Used to contain form action buttons. */ | ||
| isAction?: 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. I know |
||
| /** Removes top spacer from label. */ | ||
| hasNoPaddingTop?: boolean; | ||
| /** ID of an individual field or a group of multiple fields. Required when a role of "group" or "radiogroup" is passed in. | ||
|
|
@@ -47,6 +49,7 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({ | |
| isInline = false, | ||
| hasNoPaddingTop = false, | ||
| isStack = false, | ||
| isAction = false, | ||
| fieldId, | ||
| role, | ||
| ouiaId, | ||
|
|
@@ -75,7 +78,7 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({ | |
|
|
||
| return ( | ||
| <div | ||
| className={css(styles.formGroup, className)} | ||
| className={css(styles.formGroup, isAction && styles.modifiers.action, className)} | ||
| {...(role && { role })} | ||
| {...(isGroupOrRadioGroup && { 'aria-labelledby': `${fieldId || randomId}-legend` })} | ||
| {...props} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Form, FormGroup, ActionGroup, FormHelperText } from '../Form'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Form, FormGroup, FormHelperText } from '../Form'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ActionList, ActionListGroup, ActionListItem } from '../ActionList'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { TextInput } from '../TextInput'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Button } from '../Button'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Checkbox } from '../Checkbox'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -147,11 +148,23 @@ export const LoginForm: React.FunctionComponent<LoginFormProps> = ({ | |||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </FormGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <ActionGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button variant="primary" type="submit" onClick={onLoginButtonClick} isBlock isDisabled={isLoginButtonDisabled}> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| {loginButtonLabel} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </ActionGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <FormGroup isAction> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <ActionList> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <ActionListGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <ActionListItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="primary" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| type="submit" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={onLoginButtonClick} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| isBlock | ||||||||||||||||||||||||||||||||||||||||||||||||||
| isDisabled={isLoginButtonDisabled} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||
| {loginButtonLabel} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </ActionListItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </ActionListGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </ActionList> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+152
to
+166
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. You could do it this way, and it would match the core login demo. There is one small different, but core could update to match the react markup. It works both ways.
Suggested change
Or we could leave the login component alone in this PR, since this would change the markup for the existing component that users may be styling or targeting using classes we would remove. And we could update the component whenever we are able to remove the deprecated ActionGroup component. |
||||||||||||||||||||||||||||||||||||||||||||||||||
| </FormGroup> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </Form> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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 gets transferred directly to text on the docs, so we should reword this to not use @deprecated (like "ActionGroup has been deprecated, please use...").