Skip to content

Commit

Permalink
Merge pull request #53 from pheralb/pheralb
Browse files Browse the repository at this point in the history
⚒️ Docs sidebar improvements + MDX Components + fix bugs.
  • Loading branch information
pheralb authored Aug 15, 2022
2 parents b709aae + 05af787 commit 2307795
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 25 deletions.
13 changes: 8 additions & 5 deletions app/docs/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
title: Getting Started with SuperUI.
title: Getting Started
tags:
- react
- tailwindcss
date: "2022-08-05"
description: SuperUI is a amazing UI library for React.
---
#### Design goals

# 🚀 Getting Started

Install SuperUI:
Install SuperUI

```bash
npm install superui
npm install
```

#### Accessibility

The design system follow WCAG standards as best it can (continuely improved!) via the use of [Radix-UI](https://www.radix-ui.com/) base components and accessible default themes.
Binary file added app/public/fonts/CascadiaCode.woff2
Binary file not shown.
Binary file removed app/public/fonts/Inter-Medium.woff2
Binary file not shown.
Binary file removed app/public/fonts/Inter-Regular.woff2
Binary file not shown.
Binary file added app/public/fonts/inter-var-latin.woff2
Binary file not shown.
68 changes: 68 additions & 0 deletions app/src/components/documents/mdx/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import {
Divider,
Heading,
ListItem,
OrderedList,
Table,
Tbody,
Td,
Text,
Th,
Thead,
Tr,
UnorderedList,
Link,
TableColumnHeaderProps,
ListProps,
TableProps,
TextProps,
TableRowProps,
TableBodyProps,
HeadingProps,
LinkProps,
ListItemProps,
} from "@chakra-ui/react";

export const MDXComponents = {
a: (props: LinkProps) => (
<Link textDecoration="underline" isExternal={true} {...props} />
),
hr: (props: TextProps) => <Divider {...props} />,
h1: (props: HeadingProps) => (
<Heading as="h1" mt={8} mb={3} size="3xl" fontWeight="light" {...props} />
),
h2: (props: HeadingProps) => (
<Heading as="h2" mt={6} mb={16} size="2xl" fontWeight="bold" {...props} />
),
h3: (props: HeadingProps) => (
<Heading as="h3" mt={8} mb={3} size="lg" fontWeight="light" {...props} />
),
h4: (props: HeadingProps) => (
<Heading
as="h4"
mt={8}
mb={3}
fontSize="24px"
fontWeight="light"
{...props}
/>
),
h5: (props: HeadingProps) => (
<Heading as="h5" mt={8} mb={3} size="md" fontWeight="light" {...props} />
),
h6: (props: HeadingProps) => (
<Heading as="h6" mt={8} mb={3} size="sm" fontWeight="light" {...props} />
),
p: (props: TextProps) => <Text fontSize="lg" mb={3} {...props} />,
table: (props: TableProps) => (
<Table variant="striped" colorScheme="orange" {...props} />
),
thead: (props: TableBodyProps) => <Thead {...props} />,
tbody: (props: TableBodyProps) => <Tbody {...props} />,
th: (props: TableColumnHeaderProps) => <Th {...props} />,
tr: (props: TableRowProps) => <Tr {...props} />,
td: (props: TableColumnHeaderProps) => <Td {...props} />,
ul: (props: ListProps) => <UnorderedList styleType="none" {...props} />,
ol: (props: ListProps) => <OrderedList styleType="none" {...props} />,
li: (props: ListItemProps) => <ListItem {...props} />,
};
2 changes: 1 addition & 1 deletion app/src/components/documents/sidebar/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const SidebarContent = (props: SidebarContentProps) => {
overflowX="hidden"
overflowY="auto"
borderRightWidth="1px"
w="60"
w="240px"
{...props}
>
<Flex direction="column" as="nav" aria-label="Main Navigation">
Expand Down
12 changes: 6 additions & 6 deletions app/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function MyApp({ Component, pageProps }: AppProps) {
showOnShallow={true}
options={{ showSpinner: false }}
/>
<ChakraProvider theme={docsTheme}>
<Layout>
<SuperUIProvider>
<SuperUIProvider>
<ChakraProvider theme={docsTheme}>
<Layout>
<Component {...pageProps} />
</SuperUIProvider>
</Layout>
</ChakraProvider>
</Layout>
</ChakraProvider>
</SuperUIProvider>
</>
);
}
Expand Down
12 changes: 8 additions & 4 deletions app/src/pages/docs/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ interface DocsPageProps {
}

// Custom Components =>
import Image from "next/image";
const MDXComponents = {
Image,
};
import { MDXComponents } from "@/components/documents/mdx";

// Plugins =>
import matter from "gray-matter";
Expand All @@ -23,13 +20,20 @@ import rehypePrism from "rehype-prism-plus";
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
import { serialize } from "next-mdx-remote/serialize";
import Sidebar from "@/components/documents/sidebar";
import { Box, Heading, Text } from "@chakra-ui/react";

const Doc = ({ source, frontMatter }: DocsPageProps) => {
return (
<Sidebar>
<Head>
<title>{frontMatter.title}</title>
</Head>
<Box mb="16" mt="5">
<Heading mb={2} fontSize="6xl">
{frontMatter.title}
</Heading>
<Text mb={5}>{frontMatter.description}</Text>
</Box>
<MDXRemote {...source} components={MDXComponents} />
</Sidebar>
);
Expand Down
5 changes: 3 additions & 2 deletions app/src/styles/docsTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ const docsTheme = extendTheme({
},
},
fonts: {
body: "Inter-Regular, sans-serif",
heading: "Inter-Medium, sans-serif",
body: "Inter, sans-serif",
heading: "Inter, sans-serif",
mono: "Cascadia, monospace",
},
styles: {
global: (props: ChakraProps) => ({
Expand Down
8 changes: 4 additions & 4 deletions app/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
@tailwind utilities;

@font-face {
font-family: "Inter-Regular";
font-family: "Inter";
font-style: normal;
font-display: optional;
src: url("/fonts/Inter-Regular.woff2") format("woff2");
src: url("/fonts/inter-var-latin.woff2") format("woff2");
}

@font-face {
font-family: "Inter-Medium";
font-family: "Cascadia";
font-style: normal;
font-display: optional;
src: url("/fonts/Inter-Medium.woff2") format("woff2");
src: url("/fonts/CascadiaCode.woff2") format("woff2");
}
8 changes: 5 additions & 3 deletions app/src/styles/prism.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pre[class*="language-"],
code[class*="language-"] {
color: #d4d4d4;
font-size: 13px;
font-size: 16px;
text-shadow: none;
font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace;
font-family: "Cascadia";
direction: ltr;
text-align: left;
white-space: pre;
Expand Down Expand Up @@ -38,7 +38,9 @@ pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
background: #1e1e1e;
background: #131314;
border: 1px solid #323236;
border-radius: 5px;
}

:not(pre) > code[class*="language-"] {
Expand Down

0 comments on commit 2307795

Please sign in to comment.