Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jun 10, 2023
1 parent 3e5fa42 commit 44aceca
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 71 deletions.
6 changes: 0 additions & 6 deletions src/app/notes/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
'use client'

import { atom } from 'jotai'
import { useParams } from 'next/navigation'
import type { NoteModel } from '@mx-space/api-client'
import type { UseQueryResult } from '@tanstack/react-query'
import type { FC } from 'react'

import { Loading } from '~/components/ui/loading'
import { useNoteByNidQuery } from '~/queries/hooks/useNoteQuery'
import { parseMarkdown } from '~/remark'

export const timelineListAtom = atom(
[] as Pick<NoteModel, 'id' | 'title' | 'nid' | 'created'>[],
)

const LoadingComponent = () => <Loading />
const PageDataHolder = (
PageImpl: FC<any>,
Expand Down
9 changes: 4 additions & 5 deletions src/components/ui/transition/factor.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { Target } from 'framer-motion'
import { Fragment } from 'react'
import { AnimatePresence, motion } from 'framer-motion'
import type { Target, TargetAndTransition } from 'framer-motion'
import type { FC, PropsWithChildren } from 'react'
import { Fragment } from 'react'
import type { BaseTransitionProps } from './typings'

import { microReboundPreset } from '~/constants/spring'

import type { BaseTransitionProps } from './typings'

interface TransitionViewParams {
from: Target
to: Target
Expand Down Expand Up @@ -76,7 +75,7 @@ export const createTransitionView = (
duration,
...animation.exit,
delay: exit / 1000,
},
} as TargetAndTransition['transition'],
}}
transition={{
duration,
Expand Down
9 changes: 3 additions & 6 deletions src/components/ui/transition/typings.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type {
HTMLMotionProps,
Inertia,
Keyframes,
Spring,
Tween,
motion,
TargetAndTransition,
} from 'framer-motion'

export interface BaseTransitionProps extends HTMLMotionProps<'div'> {
Expand All @@ -19,8 +16,8 @@ export interface BaseTransitionProps extends HTMLMotionProps<'div'> {
}

animation?: {
enter?: Tween | Spring | Keyframes | Inertia
exit?: Tween | Spring | Keyframes | Inertia
enter?: TargetAndTransition['transition']
exit?: TargetAndTransition['transition']
}
/**
* @default true
Expand Down
102 changes: 51 additions & 51 deletions src/constants/meta-icon.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
import type { FC } from 'react'
import React from 'react'
// import type { FC } from 'react'
// import React from 'react'

import {
FaSolidAngry,
FaSolidFlushed,
FaSolidFrownOpen,
FaSolidGrimace,
FaSolidGrinSquintTears,
FaSolidMeh,
FaSolidSadCry,
FaSolidSadTear,
FaSolidSmile,
FaSolidTired,
} from '~/components/ui/Icons/emoji'
import { PhSunBold } from '~/components/ui/Icons/layout'
import {
BiCloudLightningRainFill,
BiCloudRainFill,
MdiCloud,
MdiSnowflake,
RiSunCloudyFill,
} from '~/components/ui/Icons/weather'
// import {
// FaSolidAngry,
// FaSolidFlushed,
// FaSolidFrownOpen,
// FaSolidGrimace,
// FaSolidGrinSquintTears,
// FaSolidMeh,
// FaSolidSadCry,
// FaSolidSadTear,
// FaSolidSmile,
// FaSolidTired,
// } from '~/components/ui/Icons/emoji'
// import { PhSunBold } from '~/components/ui/Icons/layout'
// import {
// BiCloudLightningRainFill,
// BiCloudRainFill,
// MdiCloud,
// MdiSnowflake,
// RiSunCloudyFill,
// } from '~/components/ui/Icons/weather'

export const weather2icon = (weather: string) => {
const map: Record<string, FC> = {
: PhSunBold,
多云: RiSunCloudyFill,
: MdiCloud,
: MdiSnowflake,
: BiCloudRainFill,
雷雨: BiCloudLightningRainFill,
}
return React.createElement(map[weather] || PhSunBold)
}
// export const weather2icon = (weather: string) => {
// const map: Record<string, FC> = {
// 晴:PhSunBold,
// 多云:RiSunCloudyFill,
// 阴:MdiCloud,
// 雪:MdiSnowflake,
// 雨:BiCloudRainFill,
// 雷雨:BiCloudLightningRainFill,
// }
// return React.createElement(map[weather] || PhSunBold)
// }

export const mood2icon = (mood: string) => {
const map: Record<string, FC> = {
开心: FaSolidSmile,
伤心: FaSolidSadTear,
大哭: FaSolidSadCry,
生气: FaSolidAngry,
痛苦: FaSolidTired,
悲哀: FaSolidMeh,
不快: FaSolidMeh,
激动: FaSolidGrinSquintTears,
担心: FaSolidFrownOpen,
可怕: FaSolidGrimace,
可恶: FaSolidAngry,
绝望: FaSolidFrownOpen,
焦虑: FaSolidFlushed,
}
return React.createElement(map[mood] || FaSolidSmile)
}
// export const mood2icon = (mood: string) => {
// const map: Record<string, FC> = {
// 开心:FaSolidSmile,
// 伤心:FaSolidSadTear,
// 大哭:FaSolidSadCry,
// 生气:FaSolidAngry,
// 痛苦:FaSolidTired,
// 悲哀:FaSolidMeh,
// 不快:FaSolidMeh,
// 激动:FaSolidGrinSquintTears,
// 担心:FaSolidFrownOpen,
// 可怕:FaSolidGrimace,
// 可恶:FaSolidAngry,
// 绝望:FaSolidFrownOpen,
// 焦虑:FaSolidFlushed,
// }
// return React.createElement(map[mood] || FaSolidSmile)
// }
8 changes: 5 additions & 3 deletions src/hooks/common/use-click-away.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @copy https://github.com/streamich/react-use/blob/master/src/useClickAway.ts
import type { RefObject } from 'react'
import { useEffect, useRef } from 'react'
import type { RefObject } from 'react'

function on<T extends Window | Document | HTMLElement | EventTarget>(
obj: T | null,
Expand Down Expand Up @@ -38,9 +38,11 @@ const useClickAway = <E extends Event = Event>(
savedCallback.current = onClickAway
}, [onClickAway])
useEffect(() => {
const handler = (event) => {
const handler = (event: React.MouseEvent) => {
const { current: el } = ref
el && !el.contains(event.target) && savedCallback.current(event)
el &&
!el.contains(event.target as any) &&
savedCallback.current(event as any)
}
for (const eventName of events) {
on(document, eventName, handler)
Expand Down

0 comments on commit 44aceca

Please sign in to comment.