Skip to content

Commit

Permalink
refactor: use Next.js src
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz committed Dec 27, 2023
1 parent 421a467 commit df0dc5a
Show file tree
Hide file tree
Showing 51 changed files with 21 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'
import { OgPlayground } from "./_components/OgPlayground";
import type { OGElement } from "./_lib/types";
import { OgPlayground } from "../components/OgPlayground";
import type { OGElement } from "../lib/types";

const initialElements: OGElement[] = [
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSProperties } from "react";
import { useEffect, useMemo, useRef, useState } from "react"
import type { OGElement } from "../_lib/types"
import type { OGElement } from "../lib/types";
import { useOg } from "./OgPlayground"

function hexToRgba(hex: string, alpha: number) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useSortable } from "@dnd-kit/sortable"
import { CSS } from '@dnd-kit/utilities';
import type { OGElement } from "../_lib/types"
import type { OGElement } from "../lib/types";
import { useOg } from "./OgPlayground"
import { BoxIcon } from "./icons/BoxIcon"
import { CircleIcon } from "./icons/CircleIcon"
Expand Down Expand Up @@ -69,10 +69,12 @@ export function ElementTab({ element }: ElementTabProps) {
</button>
<button
className="text-gray-600 hover:text-gray-900"
onClick={() => { updateElement({
...element,
visible: !element.visible,
}); }}
onClick={() => {
updateElement({
...element,
visible: !element.visible,
});
}}
type="button"
>
{element.visible ? <VisibleIcon /> : <NotVisibleIcon />}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DragEndEvent } from "@dnd-kit/core";
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
import { SortableContext, arrayMove, sortableKeyboardCoordinates, verticalListSortingStrategy } from "@dnd-kit/sortable";
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import { exportToPng, exportToSvg } from "../_lib/export";
import { exportToPng, exportToSvg } from "../lib/export";
import { ElementTab } from "./ElementTab";
import { useOg } from "./OgPlayground";
import { Button } from "./Button";
Expand Down Expand Up @@ -88,18 +88,18 @@ export function LeftPanel() {

async function getFonts() {
return Promise.all(elements.filter(element => element.tag === 'p' || element.tag === 'span').map(async element => {
// @ts-expect-error wrong inference
// @ts-expect-error -- wrong inference
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access -- wrong inference
const fontName = element.fontFamily.toLowerCase().replace(' ', '-')
// @ts-expect-error wrong inference
// @ts-expect-error -- wrong inference
const data = await fetch(`https://fonts.bunny.net/${fontName}/files/${fontName}-latin-${element.fontWeight}-normal.woff`).then(response => response.arrayBuffer())

return {
// @ts-expect-error wrong inference
// @ts-expect-error -- wrong inference
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- wrong inference
name: element.fontFamily,
data,
// @ts-expect-error wrong inference
// @ts-expect-error -- wrong inference
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- wrong inference
weight: element.fontWeight,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RefObject } from "react";
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import type { OGElement } from "../_lib/types";
import type { OGElement } from "../lib/types";
import { Element } from './Element'
import { RightPanel } from "./RightPanel";
import { LeftPanel } from "./LeftPanel";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from "react"
import type { OGElement } from "../_lib/types"
import type { OGElement } from "../lib/types"
import { TextIcon } from "./icons/TextIcon"
import { CircleIcon } from "./icons/CircleIcon"
import { ImageIcon } from "./icons/ImageIcon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FONTS, WEIGHTS } from "../_lib/fonts";
import { FONTS, WEIGHTS } from "../lib/fonts";
import { Button } from "./Button";
import { Input, Select } from "./Labels";
import { useOg } from "./OgPlayground";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions apps/dashboard/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import type { Config } from 'tailwindcss'

const config: Config = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
'./src/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@ogstudio/typescript/nextjs.json",
"compilerOptions": {
"plugins": [
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/turbo.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": [
"//"
],
Expand Down

0 comments on commit df0dc5a

Please sign in to comment.