Skip to content

Commit

Permalink
Merge pull request #491 from act-org/jc-skeleton
Browse files Browse the repository at this point in the history
docs: Added stories for Skeleton component from MUI
  • Loading branch information
joncursi authored Nov 12, 2024
2 parents 615a77e + 3f6cc5d commit ed7593d
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/_muiCore/Skeleton/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Skeleton ACT theme matches the snapshot 1`] = `
<div>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse css-l7mhj7-MuiSkeleton-root"
style="width: 100px; height: 100px;"
/>
</div>
`;

exports[`Skeleton ACT_ET theme matches the snapshot 1`] = `
<div>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse css-8l655q-MuiSkeleton-root"
style="width: 100px; height: 100px;"
/>
</div>
`;

exports[`Skeleton ENCOURA theme matches the snapshot 1`] = `
<div>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse css-15om3bo-MuiSkeleton-root"
style="width: 100px; height: 100px;"
/>
</div>
`;

exports[`Skeleton ENCOURA_CLASSIC theme matches the snapshot 1`] = `
<div>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse css-121fxnd-MuiSkeleton-root"
style="width: 100px; height: 100px;"
/>
</div>
`;

exports[`Skeleton ENCOURAGE theme matches the snapshot 1`] = `
<div>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse css-23i7u8-MuiSkeleton-root"
style="width: 100px; height: 100px;"
/>
</div>
`;
74 changes: 74 additions & 0 deletions src/components/_muiCore/Skeleton/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright (c) ACT, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import { Meta, StoryObj } from '@storybook/react';

import { Skeleton } from './internal';

/**
* Renders a standard MUI [Skeleton](https://mui.com/material-ui/react-skeleton/)
* using the chosen theme parameters.
*/
export default {
args: {
height: 100,
style: { fontSize: 20 },
width: 300,
},
argTypes: {},
component: Skeleton,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
title: 'MUI Core / Skeleton',
} as Meta<Skeleton>;

export const Default: StoryObj<Skeleton> = {
args: {},
};

export const AnimationPulse: StoryObj<Skeleton> = {
args: { animation: 'pulse' },
name: 'Animation: Pulse',
};

export const AnimationWave: StoryObj<Skeleton> = {
args: { animation: 'wave' },
name: 'Animation: Wave',
};

export const AnimationNone: StoryObj<Skeleton> = {
args: { animation: false },
name: 'Animation: None',
};

export const VariantRectangular: StoryObj<Skeleton> = {
args: { variant: 'rectangular' },
name: 'Variant: Rectangular',
};

export const VariantCircular: StoryObj<Skeleton> = {
args: { height: 100, variant: 'circular', width: 100 },
name: 'Variant: Circular',
};

export const VariantRounded: StoryObj<Skeleton> = {
args: { variant: 'rounded' },
name: 'Variant: Rounded',
};

export const VariantText: StoryObj<Skeleton> = {
args: { variant: 'text' },
name: 'Variant: Text',
};

export const CustomColor: StoryObj<Skeleton> = {
args: {
sx: { bgcolor: 'grey.900' },
},
};
15 changes: 15 additions & 0 deletions src/components/_muiCore/Skeleton/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) ACT, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import { Skeleton } from '@mui/material';

import { standard } from '~/helpers/test';

describe('Skeleton', () => {
const Component = <Skeleton height={100} width={100} />;
standard(Component);
});
15 changes: 15 additions & 0 deletions src/components/_muiCore/Skeleton/internal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) ACT, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import {
Skeleton as MuiSkeleton,
SkeletonProps as MuiSkeletonProps,
} from '@mui/material';

export const Skeleton = MuiSkeleton;
export type Skeleton = typeof MuiSkeleton;
export type SkeletonProps = MuiSkeletonProps;

0 comments on commit ed7593d

Please sign in to comment.