Skip to content

Commit

Permalink
Loader docs + preview (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits authored Sep 28, 2023
1 parent d07a4ef commit 3fda742
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
19 changes: 19 additions & 0 deletions @stellar/design-system-website/docs/components/elements/loader.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /loader
---

# Loader

<ComponentDescription componentName="Loader" />

## Example

```tsx live
<PreviewBlock componentName="Loader">
<Loader />
</PreviewBlock>
```

## Props

<ComponentProps componentName="Loader" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentPreview } from "@site/src/components/PreviewBlock";

export const loaderPreview: ComponentPreview = {
options: [
{
type: "select",
prop: "size",
options: [
{
value: "",
label: "Default size",
},
{
value: "2rem",
label: "2 rem",
},
{
value: "3rem",
label: "3 rem",
},
],
},
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { buttonPreview } from "@site/src/componentPreview/buttonPreview";
import { captionPreview } from "@site/src/componentPreview/captionPreview";
import { headingPreview } from "@site/src/componentPreview/headingPreview";
import { linkPreview } from "@site/src/componentPreview/linkPreview";
import { loaderPreview } from "@site/src/componentPreview/loaderPreview";
import { notificationPreview } from "@site/src/componentPreview/notificationPreview ";
import { paragraphPreview } from "@site/src/componentPreview/paragraphPreview";
import { profilePreview } from "@site/src/componentPreview/profilePreview";
Expand All @@ -30,6 +31,7 @@ const previews: { [key: string]: ComponentPreview } = {
Caption: captionPreview,
Heading: headingPreview,
Link: linkPreview,
Loader: loaderPreview,
Notification: notificationPreview,
Paragraph: paragraphPreview,
Profile: profilePreview,
Expand Down
7 changes: 6 additions & 1 deletion @stellar/design-system/src/components/Loader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from "react";
import "./styles.scss";

interface LoaderProps {
/** */
export interface LoaderProps {
/** Set custom size of the component */
size?: string;
}

/**
* Loader component color is set in CSS, and the size can also be set in CSS or through the `size` prop.
*/
export const Loader: React.FC<LoaderProps> = ({ size }: LoaderProps) => {
const customStyle = {
...(size ? { "--Loader-size": size } : {}),
Expand Down

0 comments on commit 3fda742

Please sign in to comment.