Skip to content

Commit

Permalink
fix: tooltip
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 2, 2023
1 parent 9e80d70 commit 5b926e3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/app/(page-detail)/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export default async (props: NextPageParams<PageParams>) => {
</BottomToUpTransitionView>
</article>

<PagePaginator />
<BottomToUpSoftScaleTransitionView delay={1000}>
<PagePaginator />
</BottomToUpSoftScaleTransitionView>
</div>
</PageLoading>

Expand Down
19 changes: 19 additions & 0 deletions src/app/notes/[id]/Transtion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client'

import { createTransitionView } from '~/components/ui/transition/factor'

export const Transition = createTransitionView({
from: {
translateY: 80,
opacity: 0.001,
},
to: {
translateY: 0,
opacity: 1,
},
preset: {
type: 'spring',
damping: 20,
stiffness: 200,
},
})
6 changes: 3 additions & 3 deletions src/app/notes/[id]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Metadata } from 'next'

import { NotSupport } from '~/components/common/NotSupport'
import { BottomToUpSoftScaleTransitionView } from '~/components/ui/transition/BottomToUpSoftScaleTransitionView'
import { BottomToUpTransitionView } from '~/components/ui/transition/BottomToUpTransitionView'
import { OnlyMobile } from '~/components/ui/viewport/OnlyMobile'
import { CommentAreaRoot } from '~/components/widgets/comment'
import { NoteMainContainer } from '~/components/widgets/note/NoteMainContainer'
Expand All @@ -20,6 +19,7 @@ import { CurrentNoteIdProvider } from '~/providers/note/CurrentNoteIdProvider'
import { queries } from '~/queries/definition'

import { Paper } from '../Paper'
import { Transition } from './Transtion'

export const generateMetadata = async ({
params,
Expand Down Expand Up @@ -89,7 +89,7 @@ export default async (
<CurrentNoteDataProvider data={data} />
<SyncNoteDataAfterLoggedIn />

<BottomToUpTransitionView className="min-w-0">
<Transition className="min-w-0">
<Paper as={NoteMainContainer}>{props.children}</Paper>
<BottomToUpSoftScaleTransitionView delay={500}>
{isCN ? (
Expand All @@ -98,7 +98,7 @@ export default async (
<CommentAreaRoot refId={noteObjectId} allowComment={allowComment} />
)}
</BottomToUpSoftScaleTransitionView>
</BottomToUpTransitionView>
</Transition>

<OnlyMobile>
<TocFAB />
Expand Down
3 changes: 0 additions & 3 deletions src/app/notes/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const SubscribeBell = dynamic(() =>
(mod) => mod.SubscribeBell,
),
)
const TocAside = dynamic(() =>
import('~/components/widgets/toc').then((mod) => mod.TocAside),
)

const PageImpl = () => {
return (
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout/header/internal/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function Activity() {
TriggerComponent={TriggerComponent}
triggerComponentProps={cMusicProps}
type="tooltip"
strategy="fixed"
>
{ownerName} 正在听 {media.title} - {media.artist}
</FloatPopover>
Expand All @@ -112,6 +113,7 @@ export function Activity() {
TriggerComponent={TriggerComponent}
triggerComponentProps={memoProcessName}
type="tooltip"
strategy="fixed"
>
{ownerName} 正在使用 {processName}
</FloatPopover>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/float-popover/FloatPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export function FloatPopover<T extends {}>(
headless && styles['headless'],
animate && styles['animate'],
type === 'tooltip'
? `max-w-[25rem] break-all rounded-xl bg-base-100 px-4 py-2 ${styles['headless']}`
? `max-w-[25rem] break-all rounded-xl px-4 py-2 ${styles['headless']}`
: styles['popover-root'],
popoverClassNames,
)}
Expand Down
2 changes: 2 additions & 0 deletions src/components/ui/transition/factor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { memo } from 'react'
import { m } from 'framer-motion'
import type {
Expand Down

1 comment on commit 5b926e3

@vercel
Copy link

@vercel vercel bot commented on 5b926e3 Jul 2, 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:

shiro – ./

shiro-git-main-innei.vercel.app
springtide.vercel.app
innei.in
shiro-innei.vercel.app

Please sign in to comment.