Skip to content

Commit

Permalink
release 0.1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Sep 1, 2023
1 parent dc796ce commit cffffbb
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export default function App() {
}
```

The `Edtior` is a React component that takes in the following props:
The `Editor` is a React component that takes in the following props:

| Prop | Type | Description | Default |
| ------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `completionApi` | `string` | The API route to use for the OpenAI completion API. | `/api/generate` |
| `className` | `string` | Additional classes to add to the editor container. | `"relative min-h-[500px] w-full max-w-screen-lg border-stone-200 bg-white p-12 px-8 sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:px-12 sm:shadow-lg"` |
| `className` | `string` | Editor container classname. | `"relative min-h-[500px] w-full max-w-screen-lg border-stone-200 bg-white p-12 px-8 sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:px-12 sm:shadow-lg"` |
| `defaultValue` | `JSONContent` or `string` | The default value to use for the editor. | [`defaultEditorContent`](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/default-content.tsx) |
| `extensions` | `Extension[]` | A list of extensions to use for the editor, in addition to the [default Novel extensions](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/extensions/index.tsx). | `[]` |
| `editorProps` | `EditorProps` | Props to pass to the underlying Tiptap editor, in addition to the [default Novel editor props](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/props.ts). | `{}` |
Expand Down
6 changes: 1 addition & 5 deletions apps/web/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { Dispatch, ReactNode, SetStateAction, createContext } from "react";
import { ThemeProvider, useTheme } from "next-themes";
import { Toaster } from "sonner";
import { Analytics } from "@vercel/analytics/react";
import { displayFontMapper, defaultFontMapper } from "@/styles/fonts";
import useLocalStorage from "@/lib/hooks/use-local-storage";
import { cn } from "@/lib/utils";

export const AppContext = createContext<{
font: string;
Expand Down Expand Up @@ -41,9 +39,7 @@ export default function Providers({ children }: { children: ReactNode }) {
}}
>
<ToasterProvider />
<div className={cn(displayFontMapper[font], defaultFontMapper[font])}>
{children}
</div>
{children}
<Analytics />
</AppContext.Provider>
</ThemeProvider>
Expand Down
40 changes: 20 additions & 20 deletions apps/web/ui/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import {
PopoverTrigger,
PopoverContent,
} from "@/ui/primitives/popover";
import { useContext } from "react";
import { AppContext } from "../app/providers";
import { FontDefault, FontSerif, FontMono } from "@/ui/icons";
// import { useContext } from "react";
// import { AppContext } from "../app/providers";
// import { FontDefault, FontSerif, FontMono } from "@/ui/icons";
import { Check, Menu as MenuIcon, Monitor, Moon, SunDim } from "lucide-react";
import { useTheme } from "next-themes";

const fonts = [
{
font: "Default",
icon: <FontDefault className="h-4 w-4" />,
},
{
font: "Serif",
icon: <FontSerif className="h-4 w-4" />,
},
{
font: "Mono",
icon: <FontMono className="h-4 w-4" />,
},
];
// const fonts = [
// {
// font: "Default",
// icon: <FontDefault className="h-4 w-4" />,
// },
// {
// font: "Serif",
// icon: <FontSerif className="h-4 w-4" />,
// },
// {
// font: "Mono",
// icon: <FontMono className="h-4 w-4" />,
// },
// ];
const appearances = [
{
theme: "System",
Expand All @@ -41,7 +41,7 @@ const appearances = [
];

export default function Menu() {
const { font: currentFont, setFont } = useContext(AppContext);
// const { font: currentFont, setFont } = useContext(AppContext);
const { theme: currentTheme, setTheme } = useTheme();

return (
Expand All @@ -50,7 +50,7 @@ export default function Menu() {
<MenuIcon className="text-stone-600" width={16} />
</PopoverTrigger>
<PopoverContent className="w-52 divide-y divide-stone-200" align="end">
<div className="p-2">
{/* <div className="p-2">
<p className="p-2 text-xs font-medium text-stone-500">Font</p>
{fonts.map(({ font, icon }) => (
<button
Expand All @@ -69,7 +69,7 @@ export default function Menu() {
{currentFont === font && <Check className="h-4 w-4" />}
</button>
))}
</div>
</div> */}
<div className="p-2">
<p className="p-2 text-xs font-medium text-stone-500">Appearance</p>
{appearances.map(({ theme, icon }) => (
Expand Down
4 changes: 2 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export default function App() {
}
```

The `Edtior` is a React component that takes in the following props:
The `Editor` is a React component that takes in the following props:

| Prop | Type | Description | Default |
| ------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `completionApi` | `string` | The API route to use for the OpenAI completion API. | `/api/generate` |
| `className` | `string` | Additional classes to add to the editor container. | `"relative min-h-[500px] w-full max-w-screen-lg border-stone-200 bg-white p-12 px-8 sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:px-12 sm:shadow-lg"` |
| `className` | `string` | Editor container classname. | `"relative min-h-[500px] w-full max-w-screen-lg border-stone-200 bg-white p-12 px-8 sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:px-12 sm:shadow-lg"` |
| `defaultValue` | `JSONContent` or `string` | The default value to use for the editor. | [`defaultEditorContent`](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/default-content.tsx) |
| `extensions` | `Extension[]` | A list of extensions to use for the editor, in addition to the [default Novel extensions](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/extensions/index.tsx). | `[]` |
| `editorProps` | `EditorProps` | Props to pass to the underlying Tiptap editor, in addition to the [default Novel editor props](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/props.ts). | `{}` |
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "novel",
"version": "0.1.16",
"version": "0.1.17",
"description": "Notion-style WYSIWYG editor with AI-powered autocompletions",
"license": "Apache-2.0",
"main": "./dist/index.js",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const inconsolata = Inconsolata({
subsets: ["latin"],
});

export const displayFontMapper = {
export const titleFontMapper = {
Default: cal.variable,
Serif: crimsonBold.variable,
Mono: inconsolataBold.variable,
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
--novel-highlight-orange: #faebdd;
--novel-highlight-pink: #faf1f5;
--novel-highlight-gray: #f1f1ef;

--font-title: "Cal Sans", sans-serif;
}

.dark-theme {
Expand All @@ -47,3 +49,8 @@
--novel-highlight-pink: #5c1a3a;
--novel-highlight-gray: #3a3a3a;
}

@font-face {
font-family: "Cal Sans";
src: local("Cal Sans"), url(CalSans-SemiBold.otf) format("otf");
}

1 comment on commit cffffbb

@vercel
Copy link

@vercel vercel bot commented on cffffbb Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.