-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5760] chore: FormFooter Sticky Styling #3344
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 1 commit
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 |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ import { css } from '@leafygreen-ui/emotion'; | |
| import { Icon } from '@leafygreen-ui/icon'; | ||
| import { MenuItem } from '@leafygreen-ui/menu'; | ||
|
|
||
| import FormFooter, { FormFooterProps } from '.'; | ||
| import { FormFooter, FormFooterProps } from '.'; | ||
|
|
||
| const wrapperStyle = css` | ||
| min-width: 40vw; | ||
|
|
@@ -80,6 +80,27 @@ const Template: StoryType<typeof FormFooter> = ({ | |
| /> | ||
| ); | ||
|
|
||
| const StickyTemplate: StoryType<typeof FormFooter> = ({ | ||
|
Collaborator
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. If this is intended to be a chromatic snapshot, it could be made more realistic by setting
Collaborator
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 don't know if we necessarily need to test that the sticky behavior works on scroll, and just leave it with a test confirming that adding |
||
| primaryButtonProps, | ||
| ...args | ||
| }: FormFooterStoryProps) => ( | ||
| <div | ||
| className={css` | ||
| padding-top: calc(100vh - 92px); | ||
| position: relative; | ||
| `} | ||
| > | ||
| <FormFooter | ||
| {...args} | ||
| primaryButtonProps={{ children: 'Button', variant: 'primary' }} | ||
| className={css` | ||
| position: sticky; | ||
| bottom: 0; | ||
| z-index: 1; | ||
adamrasheed marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `} | ||
| /> | ||
| </div> | ||
| ); | ||
| export const LiveExample: StoryObj<FormFooterProps> = { | ||
| render: Template, | ||
| parameters: { | ||
|
|
@@ -120,3 +141,8 @@ export const DarkMode: StoryObj<typeof FormFooter> = { | |
| darkMode: true, | ||
| }, | ||
| }; | ||
|
|
||
| export const StickyFooter: StoryObj<typeof FormFooter> = { | ||
| render: StickyTemplate, | ||
| args: {}, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,7 @@ import { palette } from '@leafygreen-ui/palette'; | |
| import { addOverflowShadow, Side } from '@leafygreen-ui/tokens'; | ||
|
|
||
| const footerBaseStyle = css` | ||
| min-height: 92px; | ||
| width: 100%; | ||
| padding: 26px 24px; | ||
| display: flex; | ||
| align-items: center; | ||
|
|
||
| button { | ||
| white-space: nowrap; | ||
| } | ||
| `; | ||
|
|
||
| const footerThemeStyle: Record<Theme, string> = { | ||
|
|
@@ -25,7 +17,20 @@ const footerThemeStyle: Record<Theme, string> = { | |
| `, | ||
| }; | ||
|
|
||
| export const contentStyle = css` | ||
| const innerContainerBaseStyle = css` | ||
| min-height: 92px; | ||
adamrasheed marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| width: 100%; | ||
| padding: 26px 24px; | ||
|
||
| display: flex; | ||
| align-items: center; | ||
| background: inherit; | ||
|
|
||
| button { | ||
| white-space: nowrap; | ||
| } | ||
| `; | ||
|
|
||
| const contentStyle = css` | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
|
|
@@ -51,10 +56,13 @@ export const getFormFooterStyles = ({ | |
| }: { | ||
| theme: Theme; | ||
| className?: string; | ||
| }) => | ||
| }) => cx(footerBaseStyle, footerThemeStyle[theme], className); | ||
|
|
||
| export const getInnerContainerStyles = ({ theme }: { theme: Theme }) => | ||
| cx( | ||
| footerBaseStyle, | ||
| footerThemeStyle[theme], | ||
| innerContainerBaseStyle, | ||
| addOverflowShadow({ side: Side.Top, theme, isInside: false }), | ||
| className, | ||
| ); | ||
|
|
||
| export const getContentStyles = (contentClassName?: string) => | ||
| cx(contentStyle, contentClassName); | ||
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.
missing changeset