diff --git a/src/components/typography/index.ts b/src/components/typography/index.ts index c2cd010f..64825e0f 100644 --- a/src/components/typography/index.ts +++ b/src/components/typography/index.ts @@ -5,3 +5,5 @@ export * from "./h2"; export * from "./h3"; export * from "./hr"; export * from "./p"; +export * from "./placeholder"; +export * from "./ul"; diff --git a/src/components/typography/placeholder/index.ts b/src/components/typography/placeholder/index.ts new file mode 100644 index 00000000..bac78960 --- /dev/null +++ b/src/components/typography/placeholder/index.ts @@ -0,0 +1 @@ +export * from "./placeholder"; diff --git a/src/components/typography/placeholder/placeholder.scss b/src/components/typography/placeholder/placeholder.scss new file mode 100644 index 00000000..4b21c8e9 --- /dev/null +++ b/src/components/typography/placeholder/placeholder.scss @@ -0,0 +1,31 @@ +.mykn-placeholder { + --mykn-placeholder-color-dark: var(--typography-color-border); + --mykn-placeholder-color-light: var(--typography-color-background-alt); + + animation: shift-background var(--animation-duration-slow) infinite + var(--animation-timing-function) reverse; + background: linear-gradient( + 90deg, + var(--mykn-placeholder-color-dark), + var(--mykn-placeholder-color-light), + var(--mykn-placeholder-color-dark) + ); + background-size: 200% 100%; + border: none; + border-radius: 1em; + display: inline-block; + height: 1em; + margin: 0; + overflow: hidden; + position: relative; + width: 100%; +} + +@keyframes shift-background { + 0% { + background-position: 0% 0%; + } + 100% { + background-position: 200% 0%; + } +} diff --git a/src/components/typography/placeholder/placeholder.stories.tsx b/src/components/typography/placeholder/placeholder.stories.tsx new file mode 100644 index 00000000..d6e963f8 --- /dev/null +++ b/src/components/typography/placeholder/placeholder.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import { Placeholder } from "./placeholder"; + +const meta: Meta = { + title: "Typography/Placeholder", + component: Placeholder, +}; + +export default meta; +type Story = StoryObj; + +export const PlaceholderComponent: Story = {}; diff --git a/src/components/typography/placeholder/placeholder.tsx b/src/components/typography/placeholder/placeholder.tsx new file mode 100644 index 00000000..aaab463d --- /dev/null +++ b/src/components/typography/placeholder/placeholder.tsx @@ -0,0 +1,13 @@ +import clsx from "clsx"; +import React from "react"; + +import "./placeholder.scss"; + +export type PlaceholderProps = React.ComponentProps<"hr">; + +/** + * Placeholder component, indicates that content is loading. + */ +export const Placeholder: React.FC = ({ ...props }) => ( +
+);