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
fix: general ui layout sizing and spacing #4487
fix: general ui layout sizing and spacing #4487
Conversation
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.
Changes looked good when I pulled it down.
@@ -21,47 +22,63 @@ import { humanFriendlyDate } from "@utils/date"; | |||
|
|||
export default function RenderHeader({ data }) { | |||
return ( | |||
<Box display="flex" justifyContent="space-between" padding="md"> | |||
<Heading display="flex" alignItems="center" gap="5px"> | |||
<Flex justify="space-between"> |
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.
Should we be using Flex
instead of Box
from now on? What are the differences?
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.
The difference between Flex
and Box
is esentially that Box
has, by default, display: block;
, whereas Flex
has display: flex;
. Outside (i.e. for their immediate parents) block
and flex
are the same, but inside, their children flow is fundamentally different. MDN can offer more detailed explanation: https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox
<Tabs> | ||
<TabList pl="md"> | ||
<Tabs variant="outline"> | ||
<TabList marginX={negateCssVar("md")} paddingX="md"> |
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.
Can you offer a short explanation for negateCssVar
?
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.
If raw values were used, negation would be as simple as adding a -
sign in front of a number (e.g. -20px
). However, in case of space tokens (which resolve to CSS custom properties), such as xs
, sm
, md
, etc., the negation needs to be somewhat more sophisticated. So what negateCssVar
does is, it takes space token and multiplies it by -1
with CSS calc
function. To put it simple, you can think of negateCssVar("md")
as something like -md
or md * -1
. In reality it is calc(var(--chakra-space-md) * -1)
.
…eneral-ui-layout-sizing-and-spacing
Closes: #4458
What's Changed
Fix general UI layout sizing and spacing on Home (
Home
), List (ObjectList
) and Object (ObjectRetrieve
) views.Home
)ObjectList
)ObjectRetrieve
)