Skip to content

Commit eb825fb

Browse files
committed
Add responsiveness to new project page
1 parent b521de4 commit eb825fb

File tree

6 files changed

+62
-30
lines changed

6 files changed

+62
-30
lines changed

Diff for: src/app/(authed)/(home)/new/layout.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use client"
2+
3+
import SecondarySplitHeader, { HEIGHT_HEADER } from "@/features/sidebar/view/SecondarySplitHeader"
4+
import { Box } from "@mui/material"
5+
6+
export default function Page({ children }: { children: React.ReactNode }) {
7+
return (
8+
<>
9+
<SecondarySplitHeader />
10+
<Box
11+
display="flex"
12+
alignItems="center"
13+
justifyContent="center"
14+
padding={{ xs: 4 }}
15+
height={{md: `calc(100vh - ${HEIGHT_HEADER + 1}px)`}}
16+
>
17+
{children}
18+
</Box>
19+
</>
20+
)
21+
}

Diff for: src/app/(authed)/(home)/new/page.tsx

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { env, splitOwnerAndRepository } from "@/common"
2-
import { Box } from "@mui/material"
32
import NewProject from "@/features/new-project/NewProject";
43

54
const Page = () => {
@@ -8,13 +7,11 @@ const Page = () => {
87
const ownerRepository = templateName ? splitOwnerAndRepository(templateName)?.owner : undefined
98

109
return (
11-
<Box display="flex" alignItems="center" justifyContent="center" height="100vh">
12-
<NewProject
13-
repositoryNameSuffix={repositoryNameSuffix}
14-
templateName={templateName}
15-
ownerRepository={ownerRepository}
16-
/>
17-
</Box>
18-
)}
10+
<NewProject
11+
repositoryNameSuffix={repositoryNameSuffix}
12+
templateName={templateName}
13+
ownerRepository={ownerRepository}
14+
/>
15+
)}
1916

2017
export default Page

Diff for: src/common/ui/HighlightText.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const HighlightText = ({
5151
variant={variant}
5252
sx={{
5353
...sx,
54-
display: { xs: "box", sm: "box", md: "flex" },
54+
display: "inline",
5555
gap: 1,
5656
}}
5757
>

Diff for: src/features/new-project/NewProject.tsx

+16-9
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ const NewProject = ({
2424
const title = "Add a new project to "
2525

2626
return (
27-
<Box display="flex" alignItems="start" justifyContent="center" flexDirection="column" height="100vh" gap={6}>
28-
<HighlightText
29-
content={`${title} ${SITE_NAME}`}
30-
highlight={SITE_NAME}
31-
color={BASE_COLORS[0]}
32-
variant="h4"
33-
isSolidOpacity
34-
/>
27+
<Box
28+
display="flex"
29+
alignItems={{ xs: "start", md: "center"}}
30+
justifyContent={{ xs: "start", md: "center"}}
31+
flexDirection="column"
32+
height={1}
33+
width={1}
34+
gap={6}
35+
>
36+
<HighlightText
37+
content={`${title} ${SITE_NAME}`}
38+
highlight={SITE_NAME}
39+
color={BASE_COLORS[0]}
40+
variant="h4"
41+
isSolidOpacity
42+
/>
3543
<NewProjectSteps
3644
repositoryNameSuffix={repositoryNameSuffix}
3745
templateName={templateName}
@@ -42,7 +50,6 @@ return (
4250
<MessageLinkFooter
4351
url={HELP_URL}
4452
content={`Read more about Adding Documentation to ${SITE_NAME}`}
45-
sx={{ position: "absolute", bottom: 30 }}
4653
/>
4754
}
4855
</Box>

Diff for: src/features/new-project/view/NewProjectSteps.tsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,45 @@ const NewProjectSteps = ({
5757

5858
const getStepContent = (step: StepType, index: number) => (
5959
<Box
60-
display="flex"
60+
display={{ xs: "inline", md: "flex"}}
6161
flexDirection="row"
6262
alignItems="center"
6363
gap={2}
64-
sx={{ width: { xs: 1, sm: 1, md: 1 } }}
64+
width={1}
6565
>
6666
{step.highlight ?
6767
<HighlightText
6868
content={`${index + 1}. ${step.content}`}
6969
highlight={step.highlight}
7070
color={BASE_COLORS[2]}
7171
height="80%"
72-
sx={{ fontSize: 20 }}
72+
sx={{ fontSize: 20, marginRight: { xs: 1 } }}
7373
isBoldText
7474
/> :
7575
<Typography sx={{
76-
display: { xs: "none", sm: "none", md: "flex" },
77-
fontSize: 20
76+
display: { md: "flex" },
77+
fontSize: 20,
78+
marginRight: { xs: 4 }
7879
}}>
7980
{`${index + 1}. `}
8081
{step.content}
8182
</Typography>
8283
}
83-
{step.helpURL && <Link
84-
style={{
85-
fontSize: 14,
86-
color: "gray"
84+
{step.helpURL &&
85+
<Typography
86+
sx={{
87+
fontSize: { xs: 16, sm: 14 },
88+
color: "gray",
8789
}}
90+
component={Link}
8891
aria-label="help"
8992
href={step.helpURL}
9093
target="_blank"
9194
rel="noopener noreferrer"
9295
>
9396
(?)
94-
</Link>}
97+
</Typography>
98+
}
9599
</Box>
96100
)
97101

Diff for: src/features/sidebar/view/SecondarySplitHeader.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { SidebarContext, isMac as checkIsMac } from "@/common"
1010
import { useSidebarOpen } from "@/features/sidebar/data"
1111
import ToggleMobileToolbarButton from "./internal/secondary/ToggleMobileToolbarButton"
1212

13+
export const HEIGHT_HEADER = 80
14+
1315
const Header = ({
1416
mobileToolbar,
1517
children
@@ -27,6 +29,7 @@ const Header = ({
2729
}, [isMac, setIsMac])
2830
const openCloseKeyboardShortcut = `(${isMac ? "⌘" : "^"} + .)`
2931
const theme = useTheme()
32+
3033
return (
3134
<Box
3235
sx={{
@@ -40,7 +43,7 @@ const Header = ({
4043
padding: 2,
4144
maxWidth: "1460px",
4245
margin: "auto",
43-
height: 80
46+
height: HEIGHT_HEADER
4447
}}>
4548
{isSidebarToggleable && !isSidebarOpen &&
4649
<Tooltip title={`Show Projects ${openCloseKeyboardShortcut}`}>

0 commit comments

Comments
 (0)