Skip to content

Commit

Permalink
fix(Loading): use description prop as SVG title (carbon-design-system…
Browse files Browse the repository at this point in the history
…#2955)

* fix(Loading): use description prop as SVG title

* docs(Loading): expose icon description props
  • Loading branch information
emyarod authored and joshblack committed Jun 11, 2019
1 parent 29d95fe commit ecfe501
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import InlineLoading from '../InlineLoading';

const props = () => ({
success: boolean('Loading successful state (success)', false),
iconDescription: text(
'Icon description (iconDescription)',
'Active loading indicator'
),
description: text(
'Loading progress description (description)',
'Loading data...'
Expand Down Expand Up @@ -105,7 +109,7 @@ storiesOf('InlineLoading', module)
info: {
text: `
This is a full example of how to levarage the <InlineLoading /> component to create a nice user experience when submitting a form.
For the full source code of this example, check out the 'story' panel below.
`,
},
Expand Down
10 changes: 9 additions & 1 deletion packages/react/src/components/InlineLoading/InlineLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export default class InlineLoading extends React.Component {
*/
description: PropTypes.string,

/**
* Specify the description for the inline loading text
*/
iconDescription: PropTypes.string,

/**
* Provide an optional handler to be inovked when <InlineLoading> is
* successful
Expand All @@ -51,6 +56,7 @@ export default class InlineLoading extends React.Component {
const {
className,
success,
iconDescription,
description,
onSuccess,
successDelay,
Expand Down Expand Up @@ -80,7 +86,9 @@ export default class InlineLoading extends React.Component {
);
}

return <Loading small withOverlay={false} />;
return (
<Loading small description={iconDescription} withOverlay={false} />
);
};

const loadingText = (
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Loading/Loading-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

import React from 'react';
import { storiesOf } from '@storybook/react';

import { withKnobs, boolean } from '@storybook/addon-knobs';
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
import Loading from '../Loading';

const props = () => ({
active: boolean('Active (active)', true),
withOverlay: boolean('With overlay (withOverlay)', false),
small: boolean('Small (small)', false),
description: text('Description (description)', 'Active loading indicator'),
});

storiesOf('Loading', module)
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class Loading extends React.Component {
aria-live={active ? 'assertive' : 'off'}
className={loadingClasses}>
<svg className={`${prefix}--loading__svg`} viewBox="-75 -75 150 150">
<title>Loading</title>
<title>{description}</title>
{small ? (
<circle
className={`${prefix}--loading__background`}
Expand Down

0 comments on commit ecfe501

Please sign in to comment.