Skip to content

Commit

Permalink
✨ NICE-43 revamp Next RSC, Notion API, & Tailwind
Browse files Browse the repository at this point in the history
BREAKING CHANGE: New Notion Implementation through Next 13 App
  • Loading branch information
JeromeFitz committed May 15, 2023
1 parent f28b27a commit 7d15a3b
Show file tree
Hide file tree
Showing 135 changed files with 3,161 additions and 290 deletions.
3 changes: 2 additions & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@heroicons/react": "2.0.17",
"@jeromefitz/shared": "workspace:*",
"@radix-ui/primitive": "1.0.0",
"@radix-ui/react-accessible-icon": "1.0.2",
"@radix-ui/react-accordion": "1.1.1",
Expand Down Expand Up @@ -80,7 +81,7 @@
"@jeromefitz/storybook-config": "workspace:*",
"@jeromefitz/tailwind-config": "workspace:*",
"@mantine/hooks": "6.0.10",
"next": "13.3.4",
"next": "13.4.1",
"react": "18.2.0",
"react-dom": "18.2.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { cx } from '@jeromefitz/shared/src/utils'
import type { Meta, StoryObj } from '@storybook/react'

import { cx } from '../../utils/cx'

import { Button } from './Button'
import { VARIANTS } from './Button.vars'

Expand Down
6 changes: 3 additions & 3 deletions packages/design-system/src/components/Button/Button.styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cx } from '../../utils/cx'
import { cx } from '@jeromefitz/shared/src/utils'

import type { Variant } from './Button.types'

Expand All @@ -13,8 +13,8 @@ export const commonStyles = cx(
)

export const variantStyles = {
default: cx('tomato-button'),
empty: cx(),
default: cx(),
empty: cx(''),
ghost: cx(),
primary: cx('tomato-button-cta'),
secondary: cx('tomato-button-outline'),
Expand Down
3 changes: 1 addition & 2 deletions packages/design-system/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { cx } from '@jeromefitz/shared/src/utils'
import { forwardRef } from 'react'
import type { ButtonHTMLAttributes, ForwardRefRenderFunction } from 'react'

import { cx } from '../../utils/cx'

import { commonStyles, variantStyles } from './Button.styles'
import type { Classname, Variant } from './Button.types'
import { VARIANTS } from './Button.vars'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { cx } from '@jeromefitz/shared/src/utils'
import type { Meta, StoryObj } from '@storybook/react'

import { cx } from '../../utils/cx'

import { ButtonLink } from './ButtonLink'

const meta = {
Expand Down
4 changes: 1 addition & 3 deletions packages/design-system/src/components/Button/ButtonLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// eslint-disable-next-line no-restricted-imports
import { cx } from '@jeromefitz/shared/src/utils'
import Link from 'next/link'
import { forwardRef } from 'react'
import type { ComponentProps, ForwardRefRenderFunction } from 'react'

import { cx } from '../../utils/cx'

import { commonStyles, variantStyles } from './Button.styles'
import type { Variant } from './Button.types'
import { VARIANTS } from './Button.vars'
Expand Down
3 changes: 1 addition & 2 deletions packages/design-system/src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { cx } from '@jeromefitz/shared/src/utils'
import type { Meta, StoryObj } from '@storybook/react'

import { cx } from '../../utils/cx'

import { MapIcon } from './Icon'

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import {
} from '@radix-ui/react-icons'
// import { Slot } from '@radix-ui/react-slot'

import { cx } from '../../utils/cx'
import { cx } from '@jeromefitz/shared/src/utils'

import { IconProps } from './Icon.types'

Expand Down
5 changes: 5 additions & 0 deletions packages/design-system/src/ui/blocks/Callout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Callout({ children }) {
return <div>{children}</div>
}

export { Callout }
7 changes: 7 additions & 0 deletions packages/design-system/src/ui/blocks/Column.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function Column({ children }) {
return (
<div className="my-3 flex flex-[1_1] flex-col md:my-3 md:pr-5">{children}</div>
)
}

export { Column }
7 changes: 7 additions & 0 deletions packages/design-system/src/ui/blocks/ColumnList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function ColumnList({ children }) {
return (
<div className="my-4 flex flex-col justify-between md:flex-row">{children}</div>
)
}

export { ColumnList }
9 changes: 9 additions & 0 deletions packages/design-system/src/ui/blocks/Divider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Divider() {
return (
<div className="my-7 h-12 w-full">
<hr />
</div>
)
}

export { Divider }
9 changes: 9 additions & 0 deletions packages/design-system/src/ui/blocks/Heading1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @note(notion) PageHeader, previous to Notion Content is H1
* => All Headings from Notion are bumped up by 1 as a result.
*/
function Heading1({ children }) {
return <h2 className="mb-3 text-3xl font-black md:mb-5 md:text-5xl">{children}</h2>
}

export { Heading1 }
11 changes: 11 additions & 0 deletions packages/design-system/src/ui/blocks/Heading2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @note(notion) PageHeader, previous to Notion Content is H1
* => All Headings from Notion are bumped up by 1 as a result.
*/
function Heading2({ children }) {
return (
<h3 className="my-4 text-xl font-black md:mt-0 md:text-4xl">{children}</h3>
)
}

export { Heading2 }
9 changes: 9 additions & 0 deletions packages/design-system/src/ui/blocks/Heading3.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @note(notion) PageHeader, previous to Notion Content is H1
* => All Headings from Notion are bumped up by 1 as a result.
*/
function Heading3({ children }) {
return <h4 className="mb-3 text-lg font-black md:text-2xl">{children}</h4>
}

export { Heading3 }
5 changes: 5 additions & 0 deletions packages/design-system/src/ui/blocks/ListBulleted.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function ListBulleted({ children }) {
return <ul className="flex list-inside list-disc flex-col">{children}</ul>
}

export { ListBulleted }
9 changes: 9 additions & 0 deletions packages/design-system/src/ui/blocks/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function ListItem({ children }) {
return (
<li>
<span className="mb-3 inline-block leading-tight">{children}</span>
</li>
)
}

export { ListItem }
5 changes: 5 additions & 0 deletions packages/design-system/src/ui/blocks/ListNumbered.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function ListNumbered({ children }) {
return <ol className="flex list-inside list-decimal flex-col">{children}</ol>
}

export { ListNumbered }
5 changes: 5 additions & 0 deletions packages/design-system/src/ui/blocks/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Paragraph({ children }) {
return <p className="mb-4 text-lg font-normal leading-normal">{children}</p>
}

export { Paragraph }
5 changes: 5 additions & 0 deletions packages/design-system/src/ui/blocks/Quote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Quote({ children }) {
return <blockquote>{children}</blockquote>
}

export { Quote }
12 changes: 12 additions & 0 deletions packages/design-system/src/ui/blocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export { Callout } from './Callout'
export { Column } from './Column'
export { ColumnList } from './ColumnList'
export { Divider } from './Divider'
export { Heading1 } from './Heading1'
export { Heading2 } from './Heading2'
export { Heading3 } from './Heading3'
export { ListBulleted } from './ListBulleted'
export { ListItem } from './ListItem'
export { ListNumbered } from './ListNumbered'
export { Paragraph } from './Paragraph'
export { Quote } from './Quote'
Empty file.
1 change: 1 addition & 0 deletions packages/next-notion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@jeromefitz/shared": "workspace:*",
"@jeromefitz/utils": "2.2.2",
"clsx": "1.2.1",
"fast-json-stable-stringify": "2.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/next-notion/src/app/components/code.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cx } from '../../utils'
import { cx } from '@jeromefitz/shared/src/utils'

import getContentTypeDetail from '../utils/getContentTypeDetail'

const code = ({ content, id }) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/next-notion/src/app/components/link.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cx } from '@jeromefitz/shared/src/utils'
import NextLink from 'next/link'

import { cx, getNextLink } from '../../utils'
import { getNextLink } from '../../utils'
const nextSeo = { url: `https://${process.env.NEXT_PUBLIC__SITE}` }
const domain = new URL(nextSeo.url)

Expand Down
5 changes: 2 additions & 3 deletions packages/next-notion/src/app/utils/TextAnnotations.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { cx } from '../../../../../sites/jeromefitzgerald.com/src/utils/cx'
import { cx } from '@jeromefitz/shared/src/utils'

import { CONTENT_NODE_TYPES, getContentNode } from '../index'

// const EmojiParser = dynamic(
Expand Down
8 changes: 0 additions & 8 deletions packages/next-notion/src/utils/cx.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next-notion/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cx } from './cx'
import { getKeysByJoin, getKeysBySlugger } from './getKey'
import getNextLink from './getNextLink'
import getNextPageStatus from './getNextPageStatus'
Expand All @@ -7,7 +6,6 @@ import isActiveLink from './isActiveLink'
import { isElementOfType } from './isElementOfType'

export {
cx,
getKeysByJoin,
getKeysBySlugger,
getNextLink,
Expand Down
7 changes: 4 additions & 3 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,21 @@
"dependencies": {
"@jeromefitz/design-system": "4.2.1",
"@tanem/react-nprogress": "5.0.37",
"clsx": "1.2.1",
"fathom-client": "3.5.0",
"lodash": "4.17.21",
"next": "13.4.1",
"next-themes": "0.2.1",
"plaiceholder": "2.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"swr": "2.1.5"
"swr": "2.1.5",
"tailwind-merge": "1.12.0"
},
"devDependencies": {
"@types/lodash": "4.14.194",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"next-notion": "workspace:*"
"@types/react-dom": "18.2.4"
},
"publishConfig": {
"access": "public"
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/shared/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { cx } from './cx'
34 changes: 28 additions & 6 deletions packages/tailwind-config/radix.plugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
const radixColors = require('@radix-ui/colors')
const plugin = require('tailwindcss/plugin')

const { backgrounds, buttons } = require('./src/index')
const { backgrounds, buttons, notion, notionColors } = require('./src/index')

/**
* @debug
*/
// console.dir(`> backgrounds`)
// console.dir(backgrounds)
// console.dir(`> buttons`)
// console.dir(buttons)
// console.dir(`> notion`)
// console.dir(notion)
/**
* @note(tailwind) radix-colors-for-tailwind
*
Expand Down Expand Up @@ -53,7 +62,7 @@ const radixPlugin = plugin.withOptions(
)
darkColors = { ...darkColors, ...dark, ...darkA }
lightColors = { ...lightColors, ...light, ...lightA }
radixStyles = { ...radixStyles, ...backgrounds, ...buttons }
radixStyles = { ...radixStyles, ...backgrounds, ...buttons, ...notion }
})
addBase({
':root': {
Expand All @@ -63,6 +72,8 @@ const radixPlugin = plugin.withOptions(
...darkColors,
},
})
// console.dir(`>> radixStyles > notions`)
// console.dir(notion)
addComponents(radixStyles)
}
},
Expand Down Expand Up @@ -90,14 +101,25 @@ const radixPlugin = plugin.withOptions(
)
return obj
}, {})
// const filteredNotion = {}
// notionColors.map((n) => {
// filteredNotion[n] = n.includes('_background')
// ? `var(--${n.split('_')[0]}6)`
// : `var(--${n}11)`
// })

const radix = {
...filtered,
...filteredA,
// ...filteredNotion,
}
// console.dir(`>> radix > filteredNotion`)
// console.dir(filteredNotion)
return {
theme: {
extend: {
colors: {
radix: {
...filtered,
...filteredA,
},
radix,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwind-config/src/backgrounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* https://www.radix-ui.com/docs/colors/palette-composition/understanding-the-scale
*
*/
const { colors, excludes } = require('./lib/const')
const { excludes, radixColors } = require('./lib/const')

const backgrounds = {}

colors.map((_color) => {
radixColors.map((_color) => {
let color = _color
if (excludes.includes(color)) {
color = `${color}A`
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwind-config/src/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* https://www.radix-ui.com/docs/colors/palette-composition/understanding-the-scale
*
*/
const { colors, excludes, foregroundTextBlack } = require('./lib/const')
const { excludes, foregroundTextBlack, radixColors } = require('./lib/const')

const buttons = {}
const types = ['', '-cta', '-outline', '-solid', '-transparent']
const buttonTypes = []

colors.map((color) => {
radixColors.map((color) => {
if (excludes.includes(color)) {
return
}
Expand Down
12 changes: 10 additions & 2 deletions packages/tailwind-config/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
const { backgrounds } = require('./backgrounds')
const { buttons, buttonTypes } = require('./buttons')
const { colors } = require('./lib/const')
const { radixColors } = require('./lib/const')
const { notion, notionColors } = require('./notion')

module.exports = { backgrounds, buttons, buttonTypes, colors }
module.exports = {
backgrounds,
buttons,
buttonTypes,
notion,
notionColors,
radixColors,
}
Loading

0 comments on commit 7d15a3b

Please sign in to comment.