Skip to content

Commit

Permalink
Merge pull request #65 from tmg0/refactor/composables
Browse files Browse the repository at this point in the history
refactor: use hero context
  • Loading branch information
tmg0 authored May 27, 2024
2 parents ae6fb19 + 1aeb748 commit 6c7f94b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/hero-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ExtractPropTypes, type PropType, defineComponent, ref } from 'vue'
import { type HeroContext, useProvideHeroContext } from './use-hero-context'
import { type HeroContext, useProvideHeroContext } from '../composables/use-hero-context'

interface Transition {
delay: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Ref, inject, provide, ref } from 'vue'
import { PROVIDE_CONTEXT } from '../constants'
import type { HeroProviderProps } from './hero-provider'
import type { HeroProviderProps } from '../components/hero-provider'

export interface Layout extends Record<string, any | undefined> {}

Expand Down
6 changes: 3 additions & 3 deletions src/composables/use-hero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useElementTransform, useMotion } from '@vueuse/motion'
import { defu } from 'defu'
import omit from 'lodash.omit'
import type { HeroProps } from '../components/hero'
import { useHeroContext } from '../components/use-hero-context'
import { useHeroContext } from '../composables/use-hero-context'

export type UseHeroProps = Omit<HeroProps, 'as'>

Expand All @@ -26,12 +26,12 @@ export function useHero(domRef: Ref<any>, props: UseHeroProps) {

const prev = computed({
get() {
if (!props.layoutId)
if (!props.layoutId)
return {}
return layouts.value[props.layoutId] ?? {}
},
set(value) {
if (!props.layoutId)
if (!props.layoutId)
return
layouts.value[props.layoutId] = value
},
Expand Down

0 comments on commit 6c7f94b

Please sign in to comment.