Skip to content

Commit

Permalink
fix: keyframe 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
Inoansta committed Feb 2, 2025
1 parent e2cb8f1 commit 09b5bb4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Keyframe } from '@/shared/components';

interface ResultInteraction {
channelName: string;
}
Expand All @@ -12,22 +14,19 @@ const animation = {
animationFillMode: 'forwards',
} as React.CSSProperties;

export function ResultInteraction({ channelName }: ResultInteraction) {
export default function ResultInteraction({ channelName }: ResultInteraction) {
return (
<div
className={
'text-white text-title3-eb px-[10px] py-[20px] text-center border border-white rounded-extraLarges bg-white bg-opacity-30 mx-[35px] absolute z-20'
}
style={animation}
>
<style>
{`
@keyframes ResultInteraction {
from { top: -20%; visibility: visible;}
to { top: 33%; visibility: visible;}
}
`}
</style>
<Keyframe
animationName={'ResultInteraction'}
from={{ top: '-20%', visibility: 'visible' }}
to={{ top: '33%', visibility: 'visible' }}
/>
{channelName}님의
<br /> 채널 분석이 완료 됐어요!
</div>
Expand Down
2 changes: 1 addition & 1 deletion spark-web/src/domains/Results/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './ResultInteraction';
export { default as ResultInteraction } from './ResultInteraction';
23 changes: 23 additions & 0 deletions spark-web/src/shared/components/Keyframe/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
interface Keyframe {
animationName: string;
from: React.CSSProperties;
to: React.CSSProperties;
}

export default function Keyframe({ animationName, from, to }: Keyframe) {
const objToCss = (obj: React.CSSProperties) =>
Object.entries(obj)
.map(([key, value]) => `${key}: ${value};`)
.join('; ');

return (
<>
<style>
{`@keyframes ${animationName}{
from{ ${objToCss(from)}}
to{ ${objToCss(to)}}
}`}
</style>
</>
);
}
1 change: 1 addition & 0 deletions spark-web/src/shared/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { default as NavigationHeader } from './NavigationHeader';
export { default as PrimaryChips } from './Chips';
export * from './Buttons';
export { default as Keyframe } from './Keyframe';
export { default as RouteMove } from './RouteMove';
export { default as NextPageFooter } from './NextPageFooter';

0 comments on commit 09b5bb4

Please sign in to comment.