Skip to content

Commit

Permalink
Icon animation (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnetangsu authored Mar 5, 2024
1 parent fb1c80c commit 879b341
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions components/Cta/Cta.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const ctaIconMap: CtaIconMapType = {
};

export const iconAnimation = {
none: '',
'top-right': 'group-hocus:translate-x-01em group-hocus:-translate-y-01em',
down: 'group-hocus:translate-y-02em',
up: 'group-hocus:-translate-y-02em',
Expand All @@ -152,6 +153,9 @@ export const iconLeftMarginDefault = 'ml-03em';
export const iconLeftMargin: CtaIconLeftMarginType = {
'arrow-right': 'ml-04em',
back: 'ml-04em',
email: 'ml-05em',
external: 'ml-04em',
link: 'ml-05em',
'triangle-right': 'ml-04em',
'triangle-down': 'ml-04em',
'triangle-up': 'ml-04em',
Expand Down
11 changes: 6 additions & 5 deletions components/HeroIcon/HeroIcon.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ export const iconBaseStyleDefault = 'w-1em';
export const iconBaseStyle: IconBaseStyleType = {
'arrow-left': 'w-09em -mt-01em',
'arrow-right': 'w-09em -mt-01em',
'triangle-right': 'w-09em scale-x-[0.9] mt-01em',
'triangle-down': 'w-09em scale-x-[0.9] rotate-90 mt-01em',
'triangle-up': 'w-09em scale-x-[0.9] -rotate-90 mt-02em',
email: 'w-[1.2em]',
'triangle-right': 'w-09em scale-x-90 mt-01em',
'triangle-down': 'w-09em scale-x-90 rotate-90 mt-01em',
'triangle-up': 'w-09em scale-x-90 -rotate-90 mt-02em',
download: 'w-09em',
email: 'w-1em',
external: 'w-08em',
left: 'w-08em',
link: 'w-1em -mt-01em',
link: 'w-09em -mt-01em',
more: 'w-08em',
plus: 'w-08em',
right: 'w-08em',
Expand Down
12 changes: 10 additions & 2 deletions components/Storyblok/SbCta.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { storyblokEditable } from '@storyblok/react/rsc';
import { CtaLink, type CtaColorType, type CtaVariantType } from '../Cta';
import {
CtaLink,
type CtaColorType,
type CtaVariantType,
type CtaCurveType,
type IconAnimationType,
} from '../Cta';
import { type IconType } from '../HeroIcon';
import { type SbLinkType } from './Storyblok.types';
import { type CtaCurveType } from '../Cta';

type SbCtaType = {
blok: {
Expand All @@ -14,6 +19,7 @@ type SbCtaType = {
curve?: CtaCurveType;
isLarge?: boolean;
icon?: IconType;
animation?: IconAnimationType;
};
};

Expand All @@ -26,6 +32,7 @@ export const SbCta = ({
curve,
isLarge,
icon,
animation,
},
blok,
}: SbCtaType) => {
Expand All @@ -43,6 +50,7 @@ export const SbCta = ({
color={color}
srText={srText}
icon={icon}
animate={animation}
>
{label}
</CtaLink>
Expand Down

0 comments on commit 879b341

Please sign in to comment.