Skip to content
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

Conversation

norbert-mieczkowski-codilime
Copy link
Collaborator

Closes: #4458

What's Changed

Fix general UI layout sizing and spacing on Home (Home), List (ObjectList) and Object (ObjectRetrieve) views.

Home (Home) List (ObjectList) Object (ObjectRetrieve)
image image_2 image_3

@HanlinMiao HanlinMiao self-requested a review September 20, 2023 14:51
Copy link
Contributor

@HanlinMiao HanlinMiao left a 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">
Copy link
Contributor

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?

Copy link
Collaborator Author

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">
Copy link
Contributor

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?

Copy link
Collaborator Author

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).

@bryanculver bryanculver merged commit 9b7844a into develop Sep 22, 2023
21 checks passed
@bryanculver bryanculver deleted the u/norbert-mieczkowski-codilime-4458-fix-general-ui-layout-sizing-and-spacing branch September 22, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve New UI Container Behavior, Filter Panel Padding
4 participants