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

feat(InlineLoading): add support for warning status #4810

Closed
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -72,8 +72,8 @@
animation-fill-mode: forwards;
}

.#{$prefix}--inline-loading--error {
fill: $support-01;
.#{$prefix}--inline-loading--error,
.#{$prefix}--inline-loading--warning {
width: rem(16px);
height: rem(16px);

Expand All @@ -82,6 +82,19 @@
}
}

.#{$prefix}--inline-loading--error {
fill: $support-01;
}

.#{$prefix}--inline-loading--warning {
fill: $support-03;
}

.#{$prefix}--inline-loading--warning path[opacity='0'] {
fill: $carbon__black-100;
opacity: 1;
}

.#{$prefix}--loading--small .#{$prefix}--inline-loading__svg {
stroke: $interactive-04;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import InlineLoading from '../InlineLoading';
const props = () => ({
status: select(
'Loading status (status)',
['inactive', 'active', 'finished', 'error'],
['inactive', 'active', 'finished', 'error', 'warning'],
'active'
),
iconDescription: text(
Expand Down
23 changes: 20 additions & 3 deletions packages/react/src/components/InlineLoading/InlineLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { CheckmarkFilled16, ErrorFilled16 } from '@carbon/icons-react';
import {
CheckmarkFilled16,
ErrorFilled16,
WarningFilled16,
} from '@carbon/icons-react';
import { settings } from 'carbon-components';
import deprecate from '../../prop-types/deprecate';
import Loading from '../Loading';
Expand All @@ -28,7 +32,14 @@ export default function InlineLoading({
const loadingClasses = classNames(`${prefix}--inline-loading`, className);
const getLoading = () => {
if (status === 'error') {
return <ErrorFilled16 className={`${prefix}--inline-loading--error`} />;
return (
<ErrorFilled16 className={`${prefix}--inline-loading--error`} />
);
}
if (status === 'warning') {
return (
<WarningFilled16 className={`${prefix}--inline-loading--warning`} />
);
}
if (status === 'finished') {
setTimeout(() => {
Expand Down Expand Up @@ -89,7 +100,13 @@ InlineLoading.propTypes = {
/**
* Specify the loading status
*/
status: PropTypes.oneOf(['inactive', 'active', 'finished', 'error']),
status: PropTypes.oneOf([
'inactive',
'active',
'finished',
'error',
'warning',
]),

/**
* Specify the description for the inline loading text
Expand Down