Skip to content

Commit

Permalink
fix: general styling
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Sep 4, 2022
1 parent 7628e25 commit 4460c57
Show file tree
Hide file tree
Showing 21 changed files with 252 additions and 244 deletions.
2 changes: 1 addition & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"minisearch": "^5.0.0",
"next": "^12.2.5",
"next-mdx-remote": "^4.1.0",
"next-progress": "^2.2.0",
"next-themes": "^0.2.0",
"nextjs-progressbar": "^0.0.14",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
Expand Down
17 changes: 15 additions & 2 deletions packages/website/src/components/AnchorButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '../../stitches.config';
import { darkTheme, styled } from '../../stitches.config';

export const AnchorButton = styled('a', {
display: 'flex',
Expand Down Expand Up @@ -29,15 +29,28 @@ export const AnchorButton = styled('a', {
variants: {
color: {
secondary: {
color: 'black',
backgroundColor: '$gray4',

'&:hover': {
backgroundColor: '$gray5',
},

'&:active': {
backgroundColor: '$gray7',
backgroundColor: '$gray6',
},

[`.${darkTheme} &`]: {
color: 'white',
},
},
},

dense: {
true: {
height: 24,
padding: '0 8px',
fontSize: 12,
},
},
},
Expand Down
10 changes: 7 additions & 3 deletions packages/website/src/components/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { styled } from '../../stitches.config';
export const Container = styled('div', {
display: 'flex',
flexDirection: 'column',
height: '100%',
placeContent: 'center',
placeItems: 'center',
padding: '0 32px',
padding: '64px 32px',
maxWidth: 1_200,
margin: 'auto',
gap: 50,

'@md': {
height: '100%',
placeContent: 'center',
padding: '0 64px',
},

variants: {
xs: {
true: {
Expand Down
14 changes: 2 additions & 12 deletions packages/website/src/components/DocContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
import { Group, Stack, Title, Text, Box, MediaQuery, Aside, ScrollArea, Skeleton, Divider } from '@mantine/core';
import { useMediaQuery } from '@mantine/hooks';
import { useRouter } from 'next/router';
import { useTheme } from 'next-themes';
import { Fragment, type PropsWithChildren } from 'react';
import {
VscSymbolClass,
Expand All @@ -19,10 +18,9 @@ import {
VscListSelection,
VscSymbolParameter,
} from 'react-icons/vsc';
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
import { vscDarkPlus, ghcolors } from 'react-syntax-highlighter/dist/cjs/styles/prism';
import { HyperlinkedText } from './HyperlinkedText';
import { Section } from './Section';
import { SyntaxHighlighter } from './SyntaxHighlighter';
import { TableOfContentItems } from './TableOfContentItems';
import { TypeParamTable } from './TypeParamTable';
import { TSDoc } from './tsdoc/TSDoc';
Expand Down Expand Up @@ -66,7 +64,6 @@ export function DocContainer({
}: DocContainerProps) {
const router = useRouter();
const matches = useMediaQuery('(max-width: 768px)');
const { theme } = useTheme();

return (
<Group>
Expand All @@ -89,14 +86,7 @@ export function DocContainer({

<Skeleton visible={router.isFallback} radius="sm">
<Box pb="xs">
<SyntaxHighlighter
wrapLongLines
language="typescript"
style={theme === 'dark' ? vscDarkPlus : ghcolors}
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
>
{excerpt}
</SyntaxHighlighter>
<SyntaxHighlighter code={excerpt} />
</Box>
</Skeleton>

Expand Down
17 changes: 17 additions & 0 deletions packages/website/src/components/SelectionButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { styled } from '../../stitches.config';

export const SelectionButton = styled('div', {
color: '$gray12',
backgroundColor: '$gray3',
padding: 10,
borderRadius: 4,

'&:hover': {
backgroundColor: '$gray4',
},

'&:active': {
backgroundColor: '$gray5',
transform: 'translate3d(0, 1px, 0)',
},
});
5 changes: 2 additions & 3 deletions packages/website/src/components/SidebarLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import { WiDaySunny, WiNightClear } from 'react-icons/wi';
import useSWR from 'swr';
import vercelLogo from '../assets/powered-by-vercel.svg';
import { SidebarItems } from './SidebarItems';
import { PACKAGES } from '~/util/constants';
import type { findMember } from '~/util/model.server';
import { PACKAGES } from '~/util/packages';

const fetcher = async (url: string) => {
const res = await fetch(url);
Expand Down Expand Up @@ -211,9 +211,8 @@ export function SidebarLayout({

return (
<AppShell
sx={(theme) => ({
sx={() => ({
main: {
background: theme.colorScheme === 'dark' ? theme.colors.dark![8] : theme.colors.gray![0],
overflowX: 'auto',
},
})}
Expand Down
3 changes: 1 addition & 2 deletions packages/website/src/components/SplitContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ export const SplitContainer = styled('div', {
display: 'flex',
placeContent: 'space-between',
placeItems: 'center',
gap: 16,
gap: 20,

variants: {
vertical: {
true: {
flexDirection: 'column',
placeContent: 'unset',
placeItems: 'unset',
},
},

Expand Down
31 changes: 31 additions & 0 deletions packages/website/src/components/SyntaxHighlighter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { PrismAsyncLight } from 'react-syntax-highlighter';
import { vscDarkPlus, ghcolors } from 'react-syntax-highlighter/dist/cjs/styles/prism';

export function SyntaxHighlighter({ language = 'typescript', code }: { code: string; language?: string }) {
return (
<>
<div data-theme="dark">
<PrismAsyncLight
wrapLines
wrapLongLines
language={language}
style={vscDarkPlus}
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
>
{code}
</PrismAsyncLight>
</div>
<div data-theme="light">
<PrismAsyncLight
wrapLines
wrapLongLines
language={language}
style={ghcolors}
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
>
{code}
</PrismAsyncLight>
</div>
</>
);
}
8 changes: 8 additions & 0 deletions packages/website/src/components/TextHighlight.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { styled } from '../../stitches.config';

export const TextHighlight = styled('span', {
position: 'relative',
backgroundColor: '$blue9',
borderRadius: 4,
padding: '4px 12px',
});
Loading

0 comments on commit 4460c57

Please sign in to comment.