Skip to content

Commit

Permalink
fix(loading): updated storybook controls, mdx, default props and tests (
Browse files Browse the repository at this point in the history
#12206)

* fix(loading): updated storybook controls, mdx, default props and tests

* fix(loading): made a playground

* fix(loading): added prop to the default story

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
sstrubberg and kodiakhq[bot] authored Oct 4, 2022
1 parent 01a2f0f commit 7458ce3
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 45 deletions.
6 changes: 0 additions & 6 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3924,12 +3924,6 @@ Map {
},
},
"Loading" => Object {
"defaultProps": Object {
"active": true,
"description": "loading",
"small": false,
"withOverlay": true,
},
"propTypes": Object {
"active": Object {
"type": "bool",
Expand Down
27 changes: 0 additions & 27 deletions packages/react/src/components/Loading/Loading-story.js

This file was deleted.

15 changes: 4 additions & 11 deletions packages/react/src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { usePrefix } from '../../internal/usePrefix';
import deprecate from '../../prop-types/deprecate';

function Loading({
active,
active = true,
className: customClassName,
withOverlay,
small,
description,
withOverlay = true,
small = false,
description = 'loading',
...rest
}) {
const prefix = usePrefix();
Expand Down Expand Up @@ -95,11 +95,4 @@ Loading.propTypes = {
withOverlay: PropTypes.bool,
};

Loading.defaultProps = {
active: true,
withOverlay: true,
small: false,
description: 'loading',
};

export default Loading;
7 changes: 6 additions & 1 deletion packages/react/src/components/Loading/Loading.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Props } from '@storybook/addon-docs';
import { Props, Preview, Story } from '@storybook/addon-docs';
import Loading from '../Loading';

# Loading

Expand All @@ -12,6 +13,10 @@ import { Props } from '@storybook/addon-docs';

## Overview

<Preview>
<Story id="components-loading--default" />
</Preview>

## Component API

<Props />
Expand Down
71 changes: 71 additions & 0 deletions packages/react/src/components/Loading/Loading.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import Loading from '.';
import mdx from './Loading.mdx';

export default {
title: 'Components/Loading',
component: Loading,
parameters: {
docs: {
page: mdx,
},
},
};

export const Default = () => {
return <Loading className={'some-class'} withOverlay={false} />;
};

export const Playground = (args) => {
return <Loading className={'some-class'} {...args} />;
};

Playground.argTypes = {
children: {
table: {
disable: true,
},
},
className: {
table: {
disable: true,
},
},
// The id prop is deprecated and should be remove in the next major release
id: {
table: {
disable: true,
},
},
active: {
control: {
type: 'boolean',
},
defaultValue: true,
},
withOverlay: {
control: {
type: 'boolean',
},
defaultValue: false,
},
small: {
control: {
type: 'boolean',
},
defaultValue: false,
},
description: {
control: {
type: 'text',
},
defaultValue: 'Loading',
},
};

0 comments on commit 7458ce3

Please sign in to comment.