Skip to content

Commit 46c49b7

Browse files
committed
LessonHeader: add default Peeranha URL if
discussionUrl not provided. Move styling out of theme and move it inline for easier editing. Shrink down QuestionIcon size.
1 parent 8507d84 commit 46c49b7

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

components/mdx/LessonHeader.tsx

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,57 @@
1-
import { Box, useStyleConfig, Text, Link, HStack } from '@chakra-ui/react'
1+
import { Box, Text, Link, HStack } from '@chakra-ui/react'
22
import NextLink from 'next/link'
33
import { QuestionIcon } from '@chakra-ui/icons'
44

55
interface LessonHeaderProps {
66
title: string
7-
discussionUrl: string
7+
discussionUrl?: string
88
}
99

10+
const DEFAULT_DISCUSSION_URL = 'https://developerdao.peeranha.io/'
11+
1012
export function LessonHeader({ title, discussionUrl }: LessonHeaderProps) {
11-
const headerStyle = useStyleConfig('LessonHeader')
13+
let forumLink = discussionUrl || DEFAULT_DISCUSSION_URL
1214

1315
return (
1416
<Box>
15-
<Box __css={headerStyle}>
16-
<Text>{title}</Text>
17+
<Box>
18+
<Text
19+
mt="1.5em"
20+
fontWeight="bold"
21+
fontSize="1.875rem"
22+
letterSpacing={-0.025}
23+
color="yellow.300"
24+
>
25+
{title}
26+
</Text>
1727
</Box>
18-
<HStack
19-
borderWidth="thin"
20-
borderColor="gray"
21-
padding="4"
22-
marginY="8"
23-
columnGap={2}
24-
maxWidth="xl"
25-
>
26-
<Box>
27-
<QuestionIcon w={12} h={12} />
28-
</Box>
29-
<Box>
30-
Please visit our{' '}
31-
<Link
32-
as={NextLink}
33-
href={discussionUrl}
34-
passHref
35-
isExternal
36-
textDecoration="underline"
37-
>
38-
forum
39-
</Link>{' '}
40-
for questions or more discussion.
41-
</Box>
42-
</HStack>
28+
{forumLink && (
29+
<HStack
30+
borderWidth="thin"
31+
borderColor="gray"
32+
padding={4}
33+
marginY={8}
34+
columnGap={2}
35+
maxWidth="xl"
36+
>
37+
<Box>
38+
<QuestionIcon w={8} h={8} />
39+
</Box>
40+
<Box>
41+
If you get stuck or have questions please visit our{' '}
42+
<Link
43+
as={NextLink}
44+
href={forumLink}
45+
passHref
46+
isExternal
47+
textDecoration="underline"
48+
>
49+
forum
50+
</Link>
51+
.
52+
</Box>
53+
</HStack>
54+
)}
4355
</Box>
4456
)
4557
}

theme.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,6 @@ const components = {
133133
},
134134
},
135135
},
136-
LessonHeader: {
137-
baseStyle: {
138-
mt: '1.5em',
139-
fontWeight: 'bold',
140-
fontSize: '1.875rem',
141-
letterSpacing: '-.025em',
142-
color: 'yellow.300',
143-
},
144-
},
145136
}
146137

147138
export const theme = extendTheme({

0 commit comments

Comments
 (0)