Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
},
};