mirror of
https://github.com/apache/superset.git
synced 2026-04-07 10:31:50 +00:00
chore: Moves Card to the components folder (#14139)
This commit is contained in:
committed by
GitHub
parent
545e257537
commit
a52ff13b5d
@@ -58,4 +58,9 @@ addParameters({
|
||||
{ name: 'Medium', value: '32px', default: true },
|
||||
{ name: 'Large', value: '64px' },
|
||||
],
|
||||
options: {
|
||||
storySort: {
|
||||
method: 'alphabetical',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import Card from 'src/common/components/Card';
|
||||
import Card from 'src/components/Card';
|
||||
import ProgressBar from 'src/components/ProgressBar';
|
||||
import Label from 'src/components/Label';
|
||||
import { t } from '@superset-ui/core';
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Card from 'src/common/components/Card';
|
||||
import Collapse from 'src/components/Collapse';
|
||||
import Card from 'src/components/Card';
|
||||
import ButtonGroup from 'src/components/ButtonGroup';
|
||||
import shortid from 'shortid';
|
||||
import { t, styled } from '@superset-ui/core';
|
||||
|
||||
@@ -61,7 +61,7 @@ export { default as List, ListItemProps } from 'antd/lib/list';
|
||||
|
||||
export { default as Collapse } from 'src/components/Collapse';
|
||||
export { default as Badge } from 'src/components/Badge';
|
||||
export { default as Card } from './Card';
|
||||
export { default as Card } from 'src/components/Card';
|
||||
export { default as Progress } from 'src/components/ProgressBar';
|
||||
|
||||
export const MenuItem = styled(AntdMenu.Item)`
|
||||
|
||||
58
superset-frontend/src/components/Card/Card.stories.tsx
Normal file
58
superset-frontend/src/components/Card/Card.stories.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import Card, { CardProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Card',
|
||||
component: Card,
|
||||
};
|
||||
|
||||
export const InteractiveCard = (args: CardProps) => <Card {...args} />;
|
||||
|
||||
InteractiveCard.args = {
|
||||
padded: true,
|
||||
title: 'Card title',
|
||||
children: 'Card content',
|
||||
bordered: true,
|
||||
loading: false,
|
||||
hoverable: false,
|
||||
};
|
||||
|
||||
InteractiveCard.argTypes = {
|
||||
onClick: {
|
||||
table: {
|
||||
disable: true,
|
||||
},
|
||||
action: 'onClick',
|
||||
},
|
||||
theme: {
|
||||
table: {
|
||||
disable: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
InteractiveCard.story = {
|
||||
parameters: {
|
||||
knobs: {
|
||||
disable: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -17,23 +17,24 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { styled } from '@superset-ui/core';
|
||||
import { SupersetTheme } from '@superset-ui/core';
|
||||
import AntdCard, { CardProps as AntdCardProps } from 'antd/lib/card';
|
||||
|
||||
interface CardProps extends AntdCardProps {
|
||||
export interface CardProps extends AntdCardProps {
|
||||
padded?: boolean;
|
||||
}
|
||||
|
||||
const Card = styled(({ padded, ...props }: CardProps) => (
|
||||
<AntdCard {...props} />
|
||||
))`
|
||||
background-color: ${({ theme }) => theme.colors.grayscale.light4};
|
||||
border-radius: ${({ theme }) => theme.borderRadius}px;
|
||||
|
||||
.ant-card-body {
|
||||
padding: ${({ padded, theme }) =>
|
||||
padded ? theme.gridUnit * 4 : theme.gridUnit}px;
|
||||
}
|
||||
`;
|
||||
const Card = ({ padded, ...props }: CardProps) => (
|
||||
<AntdCard
|
||||
{...props}
|
||||
css={(theme: SupersetTheme) => ({
|
||||
backgroundColor: theme.colors.grayscale.light4,
|
||||
borderRadius: theme.borderRadius,
|
||||
'.ant-card-body': {
|
||||
padding: padded ? theme.gridUnit * 4 : theme.gridUnit,
|
||||
},
|
||||
})}
|
||||
/>
|
||||
);
|
||||
|
||||
export default Card;
|
||||
@@ -19,8 +19,8 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Col } from 'react-bootstrap';
|
||||
import Card from 'src/common/components/Card';
|
||||
import { Radio } from 'src/components/Radio';
|
||||
import Card from 'src/components/Card';
|
||||
import Alert from 'src/components/Alert';
|
||||
import Badge from 'src/components/Badge';
|
||||
import shortid from 'shortid';
|
||||
|
||||
Reference in New Issue
Block a user