-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix visual regressions on refund with line items view #5951
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9b385bb
Fix warning missing margin
witoszekdev d12251d
Fix box missing spacing
witoszekdev 6e270c2
Use smaller gap, reuse component
witoszekdev 7201b7f
Optically align checkbox
witoszekdev 2c78039
Add possibility to override layout breakpoints
witoszekdev 0204de8
Use custom breakpoints for OrderTransactionRefundPage
witoszekdev 4afa890
Refactor transaction grid to avoid overflows
witoszekdev 8c03254
Fix broken sidebar when customized
witoszekdev f5966c2
Add proper scroll to order transaction tiles
witoszekdev 90c2c2b
Fix rendering bugs on firefox
witoszekdev 434e95c
Add better paddings
witoszekdev d171c43
Add changeset
witoszekdev 0b34981
CR: remove !important
witoszekdev 3ebbd15
CR: use css variables and add comments
witoszekdev e20aa93
CR: Add better explanation
witoszekdev 4dec10a
Merge branch 'main' into eng-838-fix-visual-regressions
witoszekdev 1a2a9c9
CR: remove empty divs
witoszekdev 829aa31
Fix failing tests
witoszekdev 9d6cdb9
Merge branch 'main' into eng-838-fix-visual-regressions
witoszekdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,19 @@ | ||
| .fullSidebarWide { | ||
| height: 100%; | ||
| display: none !important; | ||
| } | ||
|
|
||
| .drawerWide { | ||
| height: 100%; | ||
| display: block !important; | ||
| } | ||
|
|
||
| @media (min-width: 1200px) { | ||
| .fullSidebarWide { | ||
| display: block !important; | ||
| } | ||
|
|
||
| .drawerWide { | ||
| display: none !important; | ||
witoszekdev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
witoszekdev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
witoszekdev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
witoszekdev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,38 +1,79 @@ | ||
| import { Box, Drawer, MenuIcon } from "@saleor/macaw-ui-next"; | ||
|
|
||
| import { SidebarContent } from "./Content"; | ||
| import classes from "./Sidebar.module.css"; | ||
| import { useSidebarBreakpointContext } from "./SidebarContext"; | ||
|
|
||
| export const Sidebar = () => ( | ||
| <> | ||
| <Box | ||
| __width="260px" | ||
| display={{ mobile: "none", tablet: "none", desktop: "block" }} | ||
| height="100%" | ||
| > | ||
| <SidebarContent /> | ||
| </Box> | ||
| <Box display={{ mobile: "block", tablet: "block", desktop: "none" }}> | ||
| <Drawer> | ||
| <Drawer.Trigger> | ||
| <Box | ||
| as="button" | ||
| borderWidth={0} | ||
| backgroundColor="default1" | ||
| cursor="pointer" | ||
| data-test-id="sidebar-drawer-open" | ||
| > | ||
| <MenuIcon /> | ||
| export const Sidebar = () => { | ||
| const { breakpoint } = useSidebarBreakpointContext(); | ||
|
|
||
| if (breakpoint === "wide") { | ||
| return ( | ||
| <> | ||
| <div className={classes.fullSidebarWide}> | ||
| <Box __width="260px" height="100%"> | ||
| <SidebarContent /> | ||
| </Box> | ||
| </Drawer.Trigger> | ||
| <Drawer.Content | ||
| backgroundColor="default2" | ||
| data-test-id="sidebar-drawer-content" | ||
| paddingTop={0} | ||
| __width="260px" | ||
| > | ||
| <SidebarContent /> | ||
| </Drawer.Content> | ||
| </Drawer> | ||
| </Box> | ||
| </> | ||
| ); | ||
| </div> | ||
| <div className={classes.drawerWide}> | ||
| <Drawer> | ||
| <Drawer.Trigger> | ||
| <Box | ||
| as="button" | ||
| borderWidth={0} | ||
| backgroundColor="default1" | ||
| cursor="pointer" | ||
| data-test-id="sidebar-drawer-open" | ||
| > | ||
| <MenuIcon /> | ||
| </Box> | ||
| </Drawer.Trigger> | ||
| <Drawer.Content | ||
| backgroundColor="default2" | ||
| data-test-id="sidebar-drawer-content" | ||
| paddingTop={0} | ||
| __width="260px" | ||
| > | ||
| <SidebarContent /> | ||
| </Drawer.Content> | ||
| </Drawer> | ||
| </div> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <Box | ||
| __width="260px" | ||
| display={{ mobile: "none", tablet: "none", desktop: "block" }} | ||
| height="100%" | ||
| > | ||
| <SidebarContent /> | ||
| </Box> | ||
| <Box display={{ mobile: "block", tablet: "block", desktop: "none" }}> | ||
| <Drawer> | ||
| <Drawer.Trigger> | ||
| <Box | ||
| as="button" | ||
| borderWidth={0} | ||
| backgroundColor="default1" | ||
| cursor="pointer" | ||
| data-test-id="sidebar-drawer-open" | ||
| > | ||
| <MenuIcon /> | ||
| </Box> | ||
| </Drawer.Trigger> | ||
| <Drawer.Content | ||
| backgroundColor="default2" | ||
| data-test-id="sidebar-drawer-content" | ||
| paddingTop={0} | ||
| __width="260px" | ||
| > | ||
| <SidebarContent /> | ||
| </Drawer.Content> | ||
| </Drawer> | ||
| </Box> | ||
| </> | ||
| ); | ||
| }; |
This file contains hidden or 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,56 @@ | ||
| import { createContext, ReactNode, useContext, useEffect, useState } from "react"; | ||
|
|
||
| type SidebarBreakpoint = "default" | "wide"; | ||
|
|
||
| interface SidebarContextValue { | ||
| breakpoint: SidebarBreakpoint; | ||
| setBreakpoint: (breakpoint: SidebarBreakpoint) => void; | ||
| } | ||
|
|
||
| const SidebarContext = createContext<SidebarContextValue | undefined>(undefined); | ||
|
|
||
| export const SidebarProvider = ({ children }: { children: ReactNode }) => { | ||
| const [breakpoint, setBreakpoint] = useState<SidebarBreakpoint>("default"); | ||
|
|
||
| return ( | ||
| <SidebarContext.Provider value={{ breakpoint, setBreakpoint }}> | ||
| {children} | ||
| </SidebarContext.Provider> | ||
| ); | ||
| }; | ||
|
|
||
| export const useSidebarBreakpointContext = () => { | ||
| const context = useContext(SidebarContext); | ||
|
|
||
| if (context === undefined) { | ||
| throw new Error("useSidebarBreakpoint must be used within a SidebarProvider"); | ||
| } | ||
|
|
||
| return context; | ||
| }; | ||
|
|
||
| /** | ||
| * Hook to set a custom sidebar breakpoint for a page. | ||
| * The breakpoint is automatically reset to "default" when the component unmounts. | ||
| * | ||
| * @param breakpoint - The breakpoint to use ("default" or "wide") | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * const MyPage = () => { | ||
| * useCustomSidebarBreakpoint("wide"); | ||
| * return <div>Page content</div>; | ||
| * }; | ||
| * ``` | ||
| */ | ||
| export const useCustomSidebarBreakpoint = (breakpoint: SidebarBreakpoint) => { | ||
| const { setBreakpoint } = useSidebarBreakpointContext(); | ||
|
|
||
| useEffect(() => { | ||
| setBreakpoint(breakpoint); | ||
|
|
||
| return () => { | ||
| setBreakpoint("default"); | ||
| }; | ||
| }, [breakpoint, setBreakpoint]); | ||
| }; |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.