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

rough layout of the new form #6960

Merged
merged 16 commits into from
Apr 30, 2024
Merged

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Apr 29, 2024

This PR adds a very rough first implementation of the look of the new project form. It is not final and does not work yet.

The important part here is that the layout is roughly right (we'll adjust spacing etc later) and that we've got all the basic elements present.

I'll hook it up to actually work in an upcoming PR.

Note: I know the use of css nesting can be contentious. Please consider this code to be more of a proof of concept. Stubbing things out in CSS is faster than creating styled components everywhere. Happy to refactor it later, but I think the important part now is to get it in.

image

The missing icon, text alignment, etc, will also be solved later.

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 6:03am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 30, 2024 6:03am

Comment on lines 14 to 24
const StyledContainer = styled('form')(({ theme }) => ({
background: theme.palette.background.default,

'> * + *': {
borderBlockStart: `1px solid ${theme.palette.divider}`,
},

'> *': {
padding: theme.spacing(7),
},
}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In JSX I prefer local styles over ones defined by ancestor. If I expect that in React "UI is the function of state" it's harder to debug when same component can have a different look depending on where it's placed. When there are styled applied to each item it's easier to have 2 components:

<StyledContainer>
  <StyledSection>...</StyledSection>
  <StyledSection>...</StyledSection>
</StyledContainer>

In current case, we can use styled section or fieldgroup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed these now. I stuck with divs for the form sections because:

  1. According to MDN, 'Sections should always have a heading, with very few exceptions.' These don't have headings and it doesn't really make sense for them to have them. The grouping is mostly visual.
  2. There is (or was?) a longstanding bug in Chrome, where fieldset elements couldn't use display: flex. Don't know if this has been fixed yet. But also, I'm not sure they're all fieldsets. The template probably wouldn't be part of the same set as the name and description, for instance, and I don't think (though I may be wrong) that form action buttons are usually in a fieldset.

So without a better choice (though I'd love to hear suggestions if you have any!) I went with the generic block-level element: the div.

@thomasheartman thomasheartman merged commit f77f8a7 into main Apr 30, 2024
9 of 13 checks passed
@thomasheartman thomasheartman deleted the feat/new-project-creation-form-layout branch April 30, 2024 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants