diff --git a/packages/vue-use-fixed-header/src/useFixedHeader.ts b/packages/vue-use-fixed-header/src/useFixedHeader.ts index dfaaf12..d71956b 100644 --- a/packages/vue-use-fixed-header/src/useFixedHeader.ts +++ b/packages/vue-use-fixed-header/src/useFixedHeader.ts @@ -32,10 +32,6 @@ export function useFixedHeader( const { enterStyles, leaveStyles } = TRANSITION_STYLES - const root = () => (options.root || options.root === null ? unref(options.root) : null) - const transitionOpacity = () => - options.transitionOpacity === undefined ? false : unref(options.transitionOpacity) - const isReduced = useReducedMotion() // State @@ -57,7 +53,7 @@ export function useFixedHeader( // Utils function getRoot() { - const _root = root() + const _root = unref(options.root) if (_root != null) return _root return document.documentElement @@ -115,7 +111,7 @@ export function useFixedHeader( setStyles({ ...enterStyles, - ...(transitionOpacity() ? { opacity: 1 } : {}), + ...(unref(options.transitionOpacity) ? { opacity: 1 } : {}), visibility: '' as CSS['visibility'], }) @@ -125,7 +121,7 @@ export function useFixedHeader( function onHidden() { if (state.value === State.LEAVE) return - setStyles({ ...leaveStyles, ...(transitionOpacity() ? { opacity: 0 } : {}) }) + setStyles({ ...leaveStyles, ...(unref(options.transitionOpacity) ? { opacity: 0 } : {}) }) setState(State.LEAVE) diff --git a/playground/assets/global.css b/playground/assets/global.css index 8a24938..a62d4f4 100644 --- a/playground/assets/global.css +++ b/playground/assets/global.css @@ -1,7 +1,7 @@ :root { font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; - background-image: var(--Gradient); + background: var(--AccentBrightColor); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; @@ -11,7 +11,9 @@ --AccentColor: #00976b; --TextColor: #494949; --WhiteColor: #fff; - --Gradient: linear-gradient(to top, #00ff8d 0%, #00c68c 100%); + --AccentBrightColor: #2fe292; + --AccentLightColor: #d5ece2; + --AccentDarkColor: #076046; } :root { diff --git a/playground/components/Header.vue b/playground/components/Header.vue index 33c6b56..0f674c7 100644 --- a/playground/components/Header.vue +++ b/playground/components/Header.vue @@ -5,6 +5,8 @@ import { useFixedHeader } from 'vue-use-fixed-header' const headerRef = ref(null) const { styles } = useFixedHeader(headerRef) + +const linkProps = { target: '_blank', class: 'Nav_List_Link' }