Skip to content

Commit a214d2f

Browse files
committed
Typed codebase + styling for Articles and article page
1 parent 6fc4fe4 commit a214d2f

18 files changed

+416
-210
lines changed

components/Button.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ export const Button = styled('button', {
55
fontSize: '$label-lg',
66
fontWeight: '500',
77
fontFamily: '$sans',
8+
letterSpacing: '-0.011rem',
9+
lineHeight: '22px',
810
color: '$blue12',
11+
display: 'flex',
12+
alignItems: 'center',
13+
gap: '$2',
914
transition: '$button',
1015
'&:hover': {
1116
backgroundColor: '$blue5'
1217
},
13-
1418
variants: {
1519
size: {
1620
default: {

components/Card.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { styled } from 'stitches.config'
2+
3+
export const Card = styled('div', {
4+
display: 'flex',
5+
flexDirection: 'column',
6+
padding: '$6 $5',
7+
width: '22rem',
8+
height: '25rem',
9+
boxShadow: '$default',
10+
background: '$slate1',
11+
borderRadius: '$lg'
12+
})

components/Navbar.tsx

+53-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import Link from 'next/link'
2-
import { GithubLogo, MagnifyingGlass } from 'phosphor-react'
2+
import { GithubLogo } from 'phosphor-react'
3+
import { Flex } from './Flex'
34
import { IconButton } from './IconButton'
4-
import SearchButton from './SearchButton'
55
import Logo from './Logo'
6-
import { Flex } from './Flex'
6+
import SearchButton from './SearchButton'
7+
import { Text } from './Text'
78

89
const GITHUB_URL = 'https://github.com/csesoc/learning-platform'
910

@@ -13,19 +14,58 @@ export default function Navbar() {
1314
as="header"
1415
css={{
1516
py: '$4',
16-
px: '$4',
17-
justifyContent: 'space-between',
17+
px: '$6',
1818
alignItems: 'center',
19-
position: 'relative',
2019
zIndex: '1'
2120
}}>
22-
<Link href="/">
23-
<button aria-label="Return to home page">
24-
<Logo />
25-
</button>
26-
</Link>
27-
<Link href="/articles">Articles</Link>
28-
<Flex>
21+
<Flex css={{ flex: 1, justifyContent: 'flex-start' }}>
22+
<Link href="/">
23+
<button aria-label="Return to home page">
24+
<Logo />
25+
</button>
26+
</Link>
27+
</Flex>
28+
<Flex
29+
css={{
30+
flex: 1,
31+
gap: '2.25rem',
32+
justifyContent: 'center'
33+
}}>
34+
<Link href="/articles">
35+
<Text
36+
as="a"
37+
size="label-lg"
38+
css={{ color: '$slate12', cursor: 'pointer' }}>
39+
Articles
40+
</Text>
41+
</Link>
42+
<Text
43+
as="a"
44+
size="label-lg"
45+
css={{
46+
color: '$slate11',
47+
userSelect: 'none',
48+
cursor: 'not-allowed'
49+
}}>
50+
Creators
51+
</Text>
52+
<Text
53+
as="a"
54+
size="label-lg"
55+
css={{
56+
color: '$slate11',
57+
userSelect: 'none',
58+
cursor: 'not-allowed'
59+
}}>
60+
About
61+
</Text>
62+
</Flex>
63+
<Flex
64+
css={{
65+
flex: 1,
66+
gap: '$3',
67+
justifyContent: 'flex-end'
68+
}}>
2969
<SearchButton />
3070
<IconButton aria-label="GitHub repository for CSESoc Learn">
3171
<a href={GITHUB_URL} target="_blank" rel="noreferrer">
@@ -36,18 +76,3 @@ export default function Navbar() {
3676
</Flex>
3777
)
3878
}
39-
40-
// <Link href="/">
41-
// <a>
42-
// <Logo />
43-
// </a>
44-
// </Link>
45-
// <Link href="">Articles</Link>
46-
47-
// <a href={GITHUB_URL} target="_blank" rel="noreferrer">
48-
// <SearchButton />
49-
// </a>
50-
// <IconButton>
51-
// <GithubLogo weight="fill" />
52-
// </IconButton>
53-
// </a>

components/SearchOverlay.tsx

+26-10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useHotkeys } from 'react-hotkeys-hook'
66
import { Flex } from './Flex'
77
import { Box } from './Box'
88
import { styled } from 'stitches.config'
9+
import { XCircle } from 'phosphor-react'
910

1011
const StyledPortal = styled(Portal.Root, {
1112
display: 'flex',
@@ -54,18 +55,33 @@ export default function SearchOverlay({
5455
}}>
5556
<Flex
5657
css={{
57-
backgroundColor: '$blue3',
58-
fontSize: '$label-sm',
59-
color: '$blue12',
60-
px: '$3',
61-
py: '$1',
62-
mb: '$1',
63-
width: 'fit-content',
64-
borderRadius: '$sm'
58+
width: 'max',
59+
justifyContent: 'space-between',
60+
alignItems: 'center'
6561
}}>
66-
Search for content (Beta). Press Esc to close. Use Cmd + K to bring up
67-
search anytime.
62+
<Flex
63+
css={{
64+
backgroundColor: '$blue3',
65+
fontSize: '$label-sm',
66+
color: '$blue12',
67+
px: '$3',
68+
py: '$1',
69+
mb: '$2',
70+
width: 'fit-content',
71+
borderRadius: '$sm'
72+
}}>
73+
Search for content (Beta). Press Esc to close. Use Cmd + K to bring
74+
up search anytime.
75+
</Flex>
76+
<button aria-label="Close search">
77+
<XCircle
78+
size={24}
79+
color="#889096"
80+
onClick={() => changeActive(false)}
81+
/>
82+
</button>
6883
</Flex>
84+
6985
<input
7086
data-stork="search"
7187
className="stork-input"

components/Text.tsx

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Based off https://github.com/radix-ui/design-system/blob/master/components/Text.tsx
2+
3+
import { styled } from '../stitches.config'
4+
5+
export const Text = styled('span', {
6+
// Reset
7+
margin: '0',
8+
fontWeight: 400,
9+
fontFamily: '$sans',
10+
fontVariantNumeric: 'tabular-nums',
11+
display: 'block',
12+
13+
variants: {
14+
size: {
15+
display: {
16+
fontSize: '$display',
17+
letterSpacing: '-0.022rem',
18+
lineHeight: '56px'
19+
},
20+
headline: {
21+
fontSize: '$headline',
22+
letterSpacing: '-0.021rem',
23+
lineHeight: '42px'
24+
},
25+
'title-lg': {
26+
fontSize: '$title-lg',
27+
letterSpacing: '-0.019rem',
28+
lineHeight: '34px'
29+
},
30+
'title-md': {
31+
fontSize: '$title-md',
32+
letterSpacing: '-0.017rem',
33+
lineHeight: '28px'
34+
},
35+
'title-sm': {
36+
fontSize: '$title-sm',
37+
letterSpacing: '-0.014rem',
38+
lineHeight: '25px'
39+
},
40+
'label-lg': {
41+
fontSize: '$label-lg',
42+
letterSpacing: '-0.011rem',
43+
lineHeight: '22px'
44+
},
45+
'label-md': {
46+
fontSize: '$label-md',
47+
letterSpacing: '-0.006rem',
48+
lineHeight: '20px'
49+
},
50+
'label-sm': {
51+
fontSize: '$label-sm',
52+
letterSpacing: '-0.003rem',
53+
lineHeight: '18px'
54+
},
55+
body: {
56+
fontSize: '$body',
57+
letterSpacing: '-0.011rem',
58+
lineHeight: '22px'
59+
}
60+
}
61+
}
62+
})

components/ThemeToggle.tsx

-49
This file was deleted.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@radix-ui/react-avatar": "^0.1.4",
1919
"@radix-ui/react-portal": "^0.1.4",
2020
"@stitches/react": "^1.2.8",
21+
"boring-avatars": "^1.6.3",
2122
"date-fns": "^2.28.0",
2223
"gray-matter": "^4.0.3",
2324
"next": "12.1.6",

pages/_app.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Navbar from 'components/Navbar'
44
// import { ThemeProvider } from 'next-themes'
55
import type { AppProps } from 'next/app'
66
import '../styles/globals.css'
7+
import { Box } from 'components/Box'
78

89
function MyApp({ Component, pageProps }: AppProps) {
910
// TODO: Use return statement when dark theme is added
@@ -14,10 +15,10 @@ function MyApp({ Component, pageProps }: AppProps) {
1415
// </ThemeProvider>
1516
// )
1617
return (
17-
<>
18+
<Box css={{ backgroundColor: '$slate2', height: '100vh' }}>
1819
<Navbar />
1920
<Component {...pageProps} />
20-
</>
21+
</Box>
2122
)
2223
}
2324

pages/articles.js

-46
This file was deleted.

0 commit comments

Comments
 (0)