Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
nnecec committed Dec 1, 2023
1 parent 4410877 commit 9832547
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 50 deletions.
1 change: 1 addition & 0 deletions core/editor/photo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Photo = ({ className, placeholder }: PropsWithChildren<PhotoProps>)
URL.revokeObjectURL(file)
}
}
return
}, [files, setSrc])

return (
Expand Down
2 changes: 1 addition & 1 deletion core/editor/tools/board-background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BoardBackground = () => {
const mesh = (enable: boolean) => {
if (enable) {
const [, i] = meshGradient(colord(color).toHex(), { amount: 5 })
setImage(i)
setImage(i!)
} else {
setImage('none')
}
Expand Down
2 changes: 1 addition & 1 deletion core/editor/tools/frame-scale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const FrameScale = () => {
max={1}
min={0.6}
onValueChange={value => {
setScale(value[0])
setScale(value[0]!)
}}
step={0.01}
value={[scale]}
Expand Down
6 changes: 3 additions & 3 deletions core/editor/tools/photo-blur-vignette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const PhotoBlurVignette = () => {
return (
<div>
<h5 className="text-sm text-stone-400">Blur Vignette</h5>
<Slider onValueChange={value => setInset(value[0])} value={[inset]} />
<Slider onValueChange={value => setTransition(value[0])} value={[transition]} />
<Slider onValueChange={value => setBlur(value[0])} value={[blur]} />
<Slider onValueChange={value => setInset(value[0]!)} value={[inset]} />
<Slider onValueChange={value => setTransition(value[0]!)} value={[transition]} />
<Slider onValueChange={value => setBlur(value[0]!)} value={[blur]} />
</div>
)
}
21 changes: 10 additions & 11 deletions core/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
"use client"
'use client'

import * as React from "react"
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
import { CheckIcon } from "@radix-ui/react-icons"
import * as React from 'react'

import { cn } from "~/core/utils"
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
import { CheckIcon } from '@radix-ui/react-icons'

import { cn } from '~/core/utils'

const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
>(({ className, ...props }, ref) => (
<CheckboxPrimitive.Root
ref={ref}
className={cn(
"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
className
'peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
className,
)}
ref={ref}
{...props}
>
<CheckboxPrimitive.Indicator
className={cn("flex items-center justify-center text-current")}
>
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
<CheckIcon className="h-4 w-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
Expand Down
14 changes: 8 additions & 6 deletions core/ui/color/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const format = (input: Input, args: Args): Output => {
return args.format === 'hex' ? rgbToHex(rgb) : rgb
})

return args.amount === 1 || list.length === 1 ? list[0] : list
return args.amount === 1 || list.length === 1 ? list[0]! : list
}

const group = (number: number, grouping: number): number => {
Expand Down Expand Up @@ -83,9 +83,9 @@ const getAverage = (data: Data, args: Args): Output => {
const rgb = { b: 0, g: 0, r: 0 }

for (let i = 0; i < data.length; i += gap) {
rgb.r += data[i]
rgb.g += data[i + 1]
rgb.b += data[i + 2]
rgb.r += data[i]!
rgb.g += data[i + 1]!
rgb.b += data[i + 2]!
}

return format([[Math.round(rgb.r / amount), Math.round(rgb.g / amount), Math.round(rgb.b / amount)]], args)
Expand All @@ -96,9 +96,11 @@ const getProminent = (data: Data, args: Args): Output => {
const colors: { [key: string]: number } = {}

for (let i = 0; i < data.length; i += gap) {
const rgb = [group(data[i], args.group), group(data[i + 1], args.group), group(data[i + 2], args.group)].join(',')
const rgb = [group(data[i]!, args.group), group(data[i + 1]!, args.group), group(data[i + 2]!, args.group)].join(
',',
)

colors[rgb] = colors[rgb] ? colors[rgb] + 1 : 1
colors[rgb] = colors[rgb] ? colors[rgb]! + 1 : 1
}

return format(
Expand Down
29 changes: 15 additions & 14 deletions core/ui/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client"
'use client'

import * as React from "react"
import * as TabsPrimitive from "@radix-ui/react-tabs"
import * as React from 'react'

import { cn } from "~/core/utils"
import * as TabsPrimitive from '@radix-ui/react-tabs'

import { cn } from '~/core/utils'

const Tabs = TabsPrimitive.Root

Expand All @@ -12,11 +13,11 @@ const TabsList = React.forwardRef<
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
className
'inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground',
className,
)}
ref={ref}
{...props}
/>
))
Expand All @@ -27,11 +28,11 @@ const TabsTrigger = React.forwardRef<
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
className
'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow',
className,
)}
ref={ref}
{...props}
/>
))
Expand All @@ -42,14 +43,14 @@ const TabsContent = React.forwardRef<
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn(
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
className
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
className,
)}
ref={ref}
{...props}
/>
))
TabsContent.displayName = TabsPrimitive.Content.displayName

export { Tabs, TabsList, TabsTrigger, TabsContent }
export { Tabs, TabsContent, TabsList, TabsTrigger }
1 change: 1 addition & 0 deletions core/ui/upload/use-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const useUpload = ({ accept = '*', multiple }: UseUploadProps = {}) => {
input.removeEventListener('change', handleChange)
}
}
return
}, [])

return [inputRef, files] as const
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"add": "pnpm dlx shadcn-ui@latest add",
"build": "next build",
"dev": "next dev",
"lint": "next lint",
"lint": "tsc --noEmit",
"start": "next start"
},
"dependencies": {
Expand Down
16 changes: 3 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"extends": "@nnecec/tsconfig/next.json",
"compilerOptions": {
"paths": {
"~/*": [
"./*"
]
"~/*": ["./*"]
},
"plugins": [
{
Expand All @@ -13,14 +11,6 @@
],
"allowJs": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"next.config.mjs",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next.config.mjs", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}

1 comment on commit 9832547

@vercel
Copy link

@vercel vercel bot commented on 9832547 Dec 1, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

deco – ./

decox.vercel.app
deco-git-main-nnecec.vercel.app
deco-nnecec.vercel.app

Please sign in to comment.