diff --git a/package.json b/package.json index f823077..8eed73d 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,8 @@ }, "./enums": "./dist/enums/index.js", "./preset": "./dist/tailwind/tailwind.preset.js", - "./constants": "./dist/constants/index.js" + "./constants": "./dist/constants/index.js", + "./stores": "./dist/stores/index.js" }, "types": "./dist/components/index.d.ts", "lint-staged": { diff --git a/src/lib/components/atoms/animation/animation.svelte b/src/lib/components/atoms/animation/animation.svelte index 6b2aa0d..506813d 100644 --- a/src/lib/components/atoms/animation/animation.svelte +++ b/src/lib/components/atoms/animation/animation.svelte @@ -2,7 +2,7 @@ import Lottie, { type AnimationDirection, type AnimationItem } from 'lottie-web' import { onMount } from 'svelte' import { RendererType } from './animation.enums' - import { isMobile } from '$lib/stores' + import { isSmallScreen } from '$lib/stores' export let src: string = 'https://lottie.host/05761115-2753-4236-8e02-049e9b61969f/X6gyzVzo8S.json' @@ -63,7 +63,7 @@ renderer, container: player, loop, - autoplay: $isMobile || (!playOnHover && autoplay), + autoplay: $isSmallScreen || (!playOnHover && autoplay), path: src, }) }) @@ -74,7 +74,7 @@ class:pointer-events-none={pointerEventsNone} style:--background-color={backgroundColor} {src} - autoplay={isMobile || (!playOnHover && autoplay)} + autoplay={isSmallScreen || (!playOnHover && autoplay)} {loop} role="img" /> diff --git a/src/lib/components/molecules/highlight-card/highlight-card.svelte b/src/lib/components/molecules/highlight-card/highlight-card.svelte index bb2a0f9..cc6c25c 100644 --- a/src/lib/components/molecules/highlight-card/highlight-card.svelte +++ b/src/lib/components/molecules/highlight-card/highlight-card.svelte @@ -2,7 +2,7 @@ import { IconEnum, Icon } from '$components' import { OVERLINE_TEXT } from '$components/atoms/title/title.classes' import { Position, Align } from '$lib/enums' - import { isMobile } from '$lib/stores' + import { isSmallScreen } from '$lib/stores' import { MediaManager, type Media } from '../media-manager' import { HighlightCardVariant } from './highlight-card.enums' import { @@ -96,12 +96,12 @@ $: isHoverVariant = variant === HighlightCardVariant.Hover function handleMouseEnter(): void { - if (!$isMobile) { + if (!$isSmallScreen) { isHovered = true } } function handleMouseLeave(): void { - if (!$isMobile) { + if (!$isSmallScreen) { isHovered = false } } @@ -113,7 +113,7 @@ on:mouseenter={handleMouseEnter} on:mouseleave={handleMouseLeave} class="highlight-card flex flex-col {backgroundColor} {itemsAlignClass} {BORDER_RADIUS}" - class:variant--hover={isHoverVariant} + class:variant--hover={isHoverVariant && !$isSmallScreen} {...link ? { ...externalLinkProps, href: link, role: 'link', tabindex: 0 } : {}} > {#if backgroundMedia} @@ -124,7 +124,7 @@ media={backgroundMedia} pointerEventsNone {isHovered} - playOnHover={isHoverVariant && !$isMobile} + playOnHover={isHoverVariant} /> {/if} diff --git a/src/lib/components/molecules/media-manager/media-manager.svelte b/src/lib/components/molecules/media-manager/media-manager.svelte index e75c832..1f02d7a 100644 --- a/src/lib/components/molecules/media-manager/media-manager.svelte +++ b/src/lib/components/molecules/media-manager/media-manager.svelte @@ -3,7 +3,7 @@ import { MediaType } from '..' import { IMAGE_DEFAULT_PROPS, VIDEO_DEFAULT_PROPS } from './media-manager.constants' import { Animation } from '$atoms' - import { isMobile } from '$lib/stores' + import { isSmallScreen } from '$lib/stores' export let media: Media export let pointerEventsNone: boolean = false @@ -34,7 +34,7 @@ } } - $: if ($isMobile && videoElement && videoMedia?.autoplay) { + $: if ($isSmallScreen && videoElement && videoMedia?.autoplay) { void videoElement.play() } @@ -53,7 +53,7 @@ } = videoMedia}