Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 208531d

Browse files
committed
chore: improve getting started
1 parent 50507bb commit 208531d

File tree

8 files changed

+95
-48
lines changed

8 files changed

+95
-48
lines changed

content/getting-started/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ Whether you're a beginner or advanced Chakra UI user, joining our community is
5454
the best way to connect with like-minded people who build great products with
5555
the library.
5656

57-
[Join our Discord](https://chakra-ui.com/discord)
57+
<JoinCommunityCards />

pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import ChakraNextImage from 'components/chakra-next-image'
3232
import { AdBanner } from 'components/chakra-pro/ad-banner'
3333
import { ChakraProAd } from 'components/chakra-pro/home-page-ad'
3434
import Container from 'components/container'
35-
import DiscordStrip from 'components/discord-strip'
35+
import { DiscordStrip } from 'components/discord-strip'
3636
import { Footer } from 'components/footer'
3737
import Header from 'components/header'
3838
import SandpackEmbed from 'components/sandpack-embed'

src/components/community-card.tsx

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Box, Text, HStack, SimpleGrid } from '@chakra-ui/react'
2+
import * as React from 'react'
3+
import DiscordIcon from './docs/discord-logo'
4+
import { FaTwitter } from 'react-icons/fa'
5+
6+
function CommunityCardItem({ children, accentColor, icon, href }) {
7+
return (
8+
<HStack
9+
as='a'
10+
href={href}
11+
justify='center'
12+
spacing='5'
13+
borderWidth='1px'
14+
py='3'
15+
px='4'
16+
rounded='lg'
17+
>
18+
<Box as='span' fontSize='xl' color={accentColor}>
19+
{icon}
20+
</Box>
21+
<Text fontWeight='semibold'>{children}</Text>
22+
</HStack>
23+
)
24+
}
25+
26+
export function JoinCommunityCards() {
27+
return (
28+
<SimpleGrid mt='8' columns={{ base: 1, md: 2 }} spacing='4'>
29+
<CommunityCardItem
30+
accentColor='#5865F2'
31+
icon={<DiscordIcon />}
32+
href='https://chakra-ui.com/discord'
33+
>
34+
Join the Discord
35+
</CommunityCardItem>
36+
<CommunityCardItem
37+
accentColor='twitter.500'
38+
icon={<FaTwitter />}
39+
href='https://twitter.com/chakra_ui'
40+
>
41+
Follow us on Twitter
42+
</CommunityCardItem>
43+
</SimpleGrid>
44+
)
45+
}

src/components/discord-strip.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Container from './container'
44
import DiscordIcon from './docs/discord-logo'
55
import { t } from 'utils/i18n'
66

7-
function DiscordStrip(props: BoxProps) {
7+
export function DiscordStrip(props: BoxProps) {
88
return (
99
<Box bg='#5865F2' {...props}>
1010
<Container py='8'>
@@ -57,5 +57,3 @@ function DiscordStrip(props: BoxProps) {
5757
</Box>
5858
)
5959
}
60-
61-
export default DiscordStrip

src/components/docs/discord-logo.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ const DiscordIcon = (props: IconProps) => (
44
<Icon viewBox='0 0 48 48' {...props}>
55
<g id='surface1615260'>
66
<path
7-
style={{
8-
stroke: 'none',
9-
fillRule: 'nonzero',
10-
fill: 'rgb(100%,100%,100%)',
11-
fillOpacity: 1,
12-
}}
7+
fill='currentColor'
8+
stroke='none'
9+
fillRule='nonzero'
1310
d='M 39.246094 10.175781 C 36.445312 8.890625 33.4375 7.941406 30.292969 7.398438 C 30.234375 7.390625 30.179688 7.414062 30.148438 7.46875 C 29.761719 8.15625 29.332031 9.050781 29.03125 9.757812 C 25.652344 9.253906 22.285156 9.253906 18.972656 9.757812 C 18.675781 9.035156 18.230469 8.15625 17.839844 7.46875 C 17.8125 7.414062 17.753906 7.390625 17.695312 7.398438 C 14.554688 7.941406 11.546875 8.886719 8.742188 10.175781 C 8.71875 10.1875 8.695312 10.203125 8.683594 10.226562 C 2.976562 18.75 1.414062 27.0625 2.183594 35.273438 C 2.183594 35.3125 2.207031 35.351562 2.238281 35.375 C 6.003906 38.140625 9.648438 39.816406 13.226562 40.929688 C 13.28125 40.945312 13.34375 40.925781 13.378906 40.878906 C 14.226562 39.722656 14.980469 38.503906 15.628906 37.222656 C 15.664062 37.148438 15.628906 37.058594 15.550781 37.027344 C 14.355469 36.574219 13.214844 36.019531 12.121094 35.390625 C 12.03125 35.339844 12.027344 35.21875 12.105469 35.15625 C 12.335938 34.984375 12.566406 34.804688 12.789062 34.625 C 12.828125 34.589844 12.882812 34.585938 12.929688 34.605469 C 20.132812 37.894531 27.925781 37.894531 35.042969 34.605469 C 35.089844 34.582031 35.144531 34.589844 35.1875 34.621094 C 35.40625 34.804688 35.636719 34.984375 35.871094 35.15625 C 35.949219 35.21875 35.945312 35.339844 35.859375 35.390625 C 34.761719 36.03125 33.621094 36.574219 32.425781 37.027344 C 32.347656 37.054688 32.3125 37.144531 32.347656 37.222656 C 33.011719 38.503906 33.765625 39.71875 34.59375 40.875 C 34.628906 40.925781 34.691406 40.945312 34.75 40.929688 C 38.34375 39.816406 41.988281 38.136719 45.753906 35.375 C 45.785156 35.351562 45.808594 35.3125 45.808594 35.273438 C 46.726562 25.78125 44.273438 17.539062 39.304688 10.230469 C 39.292969 10.203125 39.273438 10.1875 39.246094 10.175781 Z M 16.703125 30.273438 C 14.535156 30.273438 12.75 28.28125 12.75 25.839844 C 12.75 23.394531 14.5 21.402344 16.703125 21.402344 C 18.921875 21.402344 20.691406 23.410156 20.65625 25.839844 C 20.65625 28.28125 18.90625 30.273438 16.703125 30.273438 Z M 31.324219 30.273438 C 29.15625 30.273438 27.371094 28.28125 27.371094 25.839844 C 27.371094 23.394531 29.121094 21.402344 31.324219 21.402344 C 33.542969 21.402344 35.3125 23.410156 35.277344 25.839844 C 35.277344 28.28125 33.542969 30.273438 31.324219 30.273438 Z M 31.324219 30.273438 '
1411
/>
1512
</g>

src/components/edit-page-button.tsx

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
import { Box, Icon, Link, Stack, chakra } from '@chakra-ui/react'
2-
import * as React from 'react'
1+
import { chakra, Icon, Link, Stack } from '@chakra-ui/react'
32
import { MdEdit } from 'react-icons/md'
43
import { t } from 'utils/i18n'
54

65
const EditPageLink = ({ href }: { href?: string }) => {
76
return (
87
<Link href={href} isExternal>
9-
<Box fontSize='sm' textAlign='right'>
10-
<Stack
11-
display='inline-flex'
12-
direction='row'
13-
spacing={1}
14-
align='center'
15-
opacity={0.7}
16-
>
17-
<Icon as={MdEdit} mr='1' />
18-
<chakra.span>
19-
{t('component.edit-page-button.edit-this-page')}
20-
</chakra.span>
21-
</Stack>
22-
</Box>
8+
<Stack
9+
fontSize='sm'
10+
textAlign='right'
11+
display='inline-flex'
12+
direction='row'
13+
spacing={1}
14+
align='center'
15+
opacity={0.7}
16+
>
17+
<Icon as={MdEdit} mr='1' />
18+
<chakra.span>
19+
{t('component.edit-page-button.edit-this-page')}
20+
</chakra.span>
21+
</Stack>
2322
</Link>
2423
)
2524
}

src/components/mdx-components/course-banner.tsx

+27-21
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
1-
import { Box, LinkBox, LinkOverlay, SimpleGrid, Text } from '@chakra-ui/react'
1+
import { Box, SimpleGrid, Text } from '@chakra-ui/react'
22
import NextImage from 'next/image'
33

44
const CourseBanner = ({
55
href,
66
image,
77
title,
8-
description,
98
}: {
109
image: string
1110
title: string
1211
description: string
1312
href: string
1413
}) => {
1514
return (
16-
<LinkBox role='group' mt='10'>
17-
<Box mb='4' rounded='lg' overflow='hidden'>
18-
<NextImage
19-
src={image}
20-
alt='Egghead Logo'
21-
layout='responsive'
22-
width='400'
23-
height='200'
24-
/>
25-
</Box>
26-
27-
<LinkOverlay href={href} target='_blank'>
15+
<Box
16+
display='block'
17+
as='a'
18+
borderWidth='1px'
19+
target='_blank'
20+
transition='box-shadow 0.1s ease-out'
21+
href={href}
22+
rounded='lg'
23+
overflow='hidden'
24+
_hover={{ shadow: 'md' }}
25+
>
26+
<NextImage
27+
src={image}
28+
alt='Egghead Logo'
29+
layout='responsive'
30+
width='400'
31+
height='200'
32+
/>
33+
<Box py='3' px='4'>
2834
<Text as='h3' fontWeight='semibold'>
2935
{title}
3036
</Text>
31-
</LinkOverlay>
32-
33-
<Text mt='2' mb='4' fontSize='sm' color='fg-muted'>
34-
{description}
35-
</Text>
36-
</LinkBox>
37+
</Box>
38+
</Box>
3739
)
3840
}
3941

4042
export const FeaturesCourses = () => {
4143
return (
42-
<SimpleGrid columns={{ base: 1, lg: 2 }} spacing={{ base: '4', md: '8' }}>
44+
<SimpleGrid
45+
mt='10'
46+
columns={{ base: 1, lg: 2 }}
47+
spacing={{ base: '4', md: '8' }}
48+
>
4349
<CourseBanner
4450
image='/course-banners/egghead-course.png'
4551
title='Egghead Course'

src/components/mdx-components/mdx-components.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { VideoPlayer } from 'components/mdx-components/video-player'
2222
import SandpackEmbed from 'components/sandpack-embed'
2323
import { TutorialCodeBlock } from 'components/tutorial/tutorial-code-block'
2424
import { TutorialFileAction } from 'components/tutorial/tutorial-file-action'
25+
import { JoinCommunityCards } from 'components/community-card'
2526

2627
const { Alert, AspectRatio, Box, chakra, Kbd } = Chakra
2728

@@ -90,6 +91,7 @@ export const MDXComponents = {
9091
ColorPalettes,
9192
ColorWrapper,
9293
FeaturesCourses,
94+
JoinCommunityCards,
9395
SandpackEmbed: (props) => (
9496
<Box my={6}>
9597
<SandpackEmbed {...props} />

0 commit comments

Comments
 (0)