-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
204ca84
commit b9e8d34
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./placeholder"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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%; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/components/typography/placeholder/placeholder.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Placeholder } from "./placeholder"; | ||
|
||
const meta: Meta<typeof Placeholder> = { | ||
title: "Typography/Placeholder", | ||
component: Placeholder, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const PlaceholderComponent: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<PlaceholderProps> = ({ ...props }) => ( | ||
<hr className={clsx("mykn-placeholder")} aria-hidden={true} {...props} /> | ||
); |