-
Notifications
You must be signed in to change notification settings - Fork 4
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
Chore/9630-UseDesignSystemSnackbarComponent #10298
base: develop
Are you sure you want to change the base?
Changes from 6 commits
3f5c125
4289723
8ce113a
7a1fa17
dbd2db7
487ff8d
6439410
5e25f8d
4d4e0f6
1940541
9228e5d
81cb504
8f660fb
ff4da29
1c15325
ad853bb
6b3d569
a6013e9
ec3c641
0580fb5
c36561f
c830268
d1626ec
63b4ec8
b9d4b2c
d0c2f9a
7d8568f
ee7371d
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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
diff --git a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/Snackbar.tsx b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/Snackbar.tsx | ||
index 6b2f54d..8931ba9 100644 | ||
--- a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/Snackbar.tsx | ||
+++ b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/Snackbar.tsx | ||
@@ -160,6 +160,7 @@ export const Snackbar: FC<SnackbarProps> = (toast) => { | ||
minHeight: 44, | ||
padding: spacing.vadsSpaceSm, | ||
marginHorizontal: spacing.vadsSpaceLg, | ||
+ marginBottom: spacing.vadsSpaceLg, | ||
rowGap: spacing.vadsSpace2xs, | ||
}, | ||
} | ||
diff --git a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbar.tsx b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbar.tsx | ||
index 2e5c464..a696fa9 100644 | ||
--- a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbar.tsx | ||
|
@@ -41,3 +53,15 @@ index 2e5c464..a696fa9 100644 | |
+ }), [show, toast.hideAll, toast.isOpen] | ||
+ ) | ||
} | ||
diff --git a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbarDefaultOffset.tsx b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbarDefaultOffset.tsx | ||
index e7679fa..135c5fa 100644 | ||
--- a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbarDefaultOffset.tsx | ||
+++ b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/Snackbar/useSnackbarDefaultOffset.tsx | ||
@@ -1,6 +1,6 @@ | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context' | ||
|
||
-const NAV_BAR_HEIGHT = 60 | ||
+const NAV_BAR_HEIGHT = 56 | ||
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. This is somewhat a design decision, but am not sure pixel perfection is necessary here. Similar to the above of deferring to the app team, but I'd recommend against patching it vs having 4 pixels more in what is already somewhat arbitrary padding for a "floating" element. |
||
|
||
/** | ||
* Returns default Snackbar offset depending on safe area bottom inset |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,7 @@ function EditDirectDepositScreen({ navigation, route }: EditDirectDepositProps) | |
if (!routingNumberError) { | ||
snackbar.show(t('directDeposit.saved.error'), { | ||
isError: true, | ||
offset: 0, | ||
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 think Narin had already suggested it somewhere, but also suggesting having the offset for non-Nav screens set in the app theming instead of having so many hard coded 0's. Make it much easier to change in the future if it's desired vs updating ~25 spots. 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. Agree, I will make this change once we get resolution on the navbar spacing. |
||
onActionPressed: () => updateBankInfo(updateBankData, mutateOptions), | ||
}) | ||
} | ||
|
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.
I see the justification for this in another comment:
The reason bottom margin was not included in the component is two fold:
The side margins were deemed acceptable to block presses as, paired with general padding for content, anything peeking should be very minimal.
I technically defer to the app team since we on the design system team long term are not responsible for how apps implement our components, but I'd recommend against patching this in as patches are frail and this is liable to break from future library changes we make to the component when updating while leveraging the offset should not.
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.
Thanks for the feedback. Just so we're all on the same page, the left screenshot below is the default location where the Snackbar gets positioned when a bottom navigation bar is present and no offset is specified. There are 4 units of vertical spacing between the top of the navbar and the Snackbar. The right screenshot shows the changes with the patch applied (20 units of vertical spacing). If we can live with the spacing on the left screenshot, then I can remove the patch easily enough. If we want more spacing but no patch, then the app will have to start passing offsets into all Snackbars. Please advise.
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.
I think the 4 units spacing is fine, but ultimately seems like a design decision. I believe the position is what it was with the old Snackbar so it'd be maintaining existing functionality and didn't come up during creating it or we'd likely have gone with a different default. As a "floating" element it can appear directly above other content regardless if it's 4 or 20 pixels from the Nav bar--the crux is not blocking the Nav bar so it's usable.
If the increased spacing is determined the way: I think a patch is fair way to go about it, but it would be better to update the default offset to 76 instead of using
marginBottom
. Longer term, we have done research into global overrides for certain design system parameters and the Snackbar offset definitely would be a good use case--but, in the absence of that yet existing, patching in a different default value seems like a reasonable workaround since when the global override exists then the only code change would be removing the patch and setting the global override in one spot.Not sure if @Sparowhawk or anyone else on the app side had thoughts since ultimately from the design system side we're just providing recommendations based on how the components were built/designed and consumer apps can do what they want.
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.
As a circle back: created a ticket to add a global override for the default Snackbar offset so it's documented as a desired future enhancement.