-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
const StyledContainer = styled('form')(({ theme }) => ({ | ||
background: theme.palette.background.default, | ||
|
||
'> * + *': { | ||
borderBlockStart: `1px solid ${theme.palette.divider}`, | ||
}, | ||
|
||
'> *': { | ||
padding: theme.spacing(7), | ||
}, | ||
})); |
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.
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
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've fixed these now. I stuck with div
s for the form sections because:
- 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.
- There is (or was?) a longstanding bug in Chrome, where
fieldset
elements couldn't usedisplay: 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
.
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.
The missing icon, text alignment, etc, will also be solved later.