Skip to content

Commit

Permalink
Merge pull request #101 from subquery/feat/tag
Browse files Browse the repository at this point in the history
feat: more components update
  • Loading branch information
HuberTRoy authored Dec 20, 2023
2 parents 3dd18ee + d10520d commit 45f5455
Show file tree
Hide file tree
Showing 23 changed files with 276 additions and 187 deletions.
4 changes: 4 additions & 0 deletions components/common/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export interface CardProps extends AntCardProps {
customDropdown?: React.ReactNode;
action?: Button;
}

/**
* @deprecated
*/
export const Card: React.FC<React.PropsWithChildren<CardProps>> = ({
title,
titleTooltip,
Expand Down
2 changes: 2 additions & 0 deletions components/common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export { default as TextInput } from './textInput';
export { default as Toast } from './toast';
export { Typography } from './typography';
export { default as SubqlCheckbox } from './checkbox';
export { SubqlCard } from './subqlCard';
export { SubqlTabs } from './subqlTabs';
export * from './notification';
export type { IGraphiQL } from './GraphiQL';
export { default as SubqlProvider } from './provider';
Expand Down
19 changes: 19 additions & 0 deletions components/common/progressBar/ProgressBar.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.subql-progress {

.ant-progress-bg {
background-color: var(--sq-blue600);
}

&.ant-progress-status-success {
.ant-progress-bg {
background-color: var(--sq-blue600);
}
.ant-progress-text {
display: none;
}

.ant-progress-outer {
padding-inline-end: 0;
}
}
}
63 changes: 0 additions & 63 deletions components/common/progressBar/ProgressBar.stories.tsx

This file was deleted.

26 changes: 6 additions & 20 deletions components/common/progressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@
import * as React from 'react';
import { Progress, ProgressProps } from 'antd';
import clsx from 'clsx';
import { useBem } from 'components/utilities/useBem';
import './ProgressBar.less';

export interface ProgressBarPros extends ProgressProps {
progress: number;
className?: string;
grayTheme?: boolean;
}
export type ProgressBarPros = ProgressProps;

export const ProgressBar: React.FC<ProgressBarPros> = ({ grayTheme, progress, className, ...props }) => {
const sortedProgress = progress <= 1 ? progress * 100 : progress;
const trailColor = grayTheme ? '#DFE3E8' : undefined;
const strokeColor = grayTheme ? 'rgba(67, 136, 221, 0.4)' : undefined;

return (
<Progress
percent={sortedProgress}
status="active"
trailColor={trailColor}
strokeColor={strokeColor}
className={clsx(grayTheme && 'grayProgressStyle', className)}
{...props}
/>
);
export const SubqlProgress: React.FC<ProgressBarPros> = ({ ...props }) => {
const bem = useBem('subql-progress');
return <Progress {...props} className={clsx(bem(), props.className)}></Progress>;
};
4 changes: 2 additions & 2 deletions components/common/spinner/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const Spinner: React.FC<Props> = ({ size, color, className }) => {
? {
height: size,
width: size,
'border-color': color,
'border-right-color': 'transparent',
borderColor: color,
borderRightColor: 'transparent',
}
: undefined;

Expand Down
33 changes: 33 additions & 0 deletions components/common/steps/Steps.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.subql-steps {
font-family: var(--sq-font-family);

.ant-steps-item-process {
.ant-steps-item-icon {
background-color: var(--sq-blue600);
border-color: var(--sq-blue600);
}
}

.ant-steps-item-finish {
.ant-steps-item-icon {
background-color: transparent;
border-color: var(--sq-blue600);
}
}

.ant-steps-item-wait {
.ant-steps-item-icon {
background-color: transparent;
border-color: var(--sq-gray400);
.ant-steps-icon {
color: var(--sq-gray400);
}
}

.ant-steps-item-content {
.ant-steps-item-title.ant-steps-item-title.ant-steps-item-title {
color: var(--sq-gray600);
}
}
}
}
3 changes: 0 additions & 3 deletions components/common/steps/Steps.module.css

This file was deleted.

45 changes: 0 additions & 45 deletions components/common/steps/Steps.stories.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions components/common/steps/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@

import * as React from 'react';
import { Steps as AntSteps, StepsProps as AntStepsProps, StepProps } from 'antd';
import styles from './Steps.module.css';
import clsx from 'clsx';
import { useBem } from 'components/utilities/useBem';
import './Steps.less';

export interface StepsProps extends AntStepsProps {
steps: Array<StepProps>;
}
export const Steps: React.FC<React.PropsWithChildren<StepsProps>> = ({ steps, ...props }) => {
const bem = useBem('subql-steps');
return (
<AntSteps size="small" {...props} className={clsx(styles.steps, props.className)}>
<AntSteps size="small" {...props} className={clsx(bem(), props.className)}>
{steps?.map((stepProps, idx) => (
<AntSteps.Step {...stepProps} key={idx}></AntSteps.Step>
))}
Expand Down
4 changes: 4 additions & 0 deletions components/common/subqlCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: Apache-2.0

export * from './subqlCard';
39 changes: 39 additions & 0 deletions components/common/subqlCard/subqlCard.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.subql-card {
border-radius: 8px;
border: 1px solid rgba(223, 227, 232, 0.6);
background: #fff;
box-shadow: 0px 1px 8px 0px rgba(67, 136, 221, 0.12);
flex-shrink: 0;
font-family: var(--sq-font-family);
.ant-card-head {
padding: 20px;
padding-bottom: 12px;
border-bottom: none;

&-title {
padding: 0;
}
}

.ant-card-body {
padding: 20px;
padding-top: 12px;
}

&--split {
width: 100%;
height: 1px;
background: var(--sq-gray300);
transform: translateY(-12px);
}

&--withoutBody {
.ant-card-head {
padding-bottom: 20px;
}

.ant-card-body {
display: none;
}
}
}
59 changes: 59 additions & 0 deletions components/common/subqlCard/subqlCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: Apache-2.0

import React, { FC } from 'react';
import { BsInfoCircle } from 'react-icons/bs';
import { Typography } from '@subql/components';
import { Card, CardProps, Tooltip } from 'antd';
import clsx from 'clsx';
import { isString } from 'lodash-es';

import './subqlCard.less';
import { useBem } from 'components/utilities/useBem';

interface SubqlCardProps extends CardProps {
title?: React.ReactNode;
titleExtra?: React.ReactNode;
tooltip?: React.ReactNode;
children?: React.ReactNode;
width?: number;
style?: React.CSSProperties;
}

export const SubqlCard: FC<SubqlCardProps> = ({
children,
title,
titleExtra,
tooltip,
width,
style,
className,
...rest
}) => {
const bem = useBem('subql-card');
return (
<Card
{...rest}
className={clsx(bem({ withoutBody: !children ? 'withoutBody' : undefined }), className)}
title={
<div className="col-flex">
<div style={{ display: 'flex', alignItems: 'center' }}>
{isString(title) ? <Typography>{title}</Typography> : title}
{tooltip ? (
<Tooltip title={tooltip}>
<BsInfoCircle style={{ color: 'var(--sq-gray500)', fontSize: 14, marginLeft: 8 }}></BsInfoCircle>
</Tooltip>
) : (
''
)}
</div>
<div style={{ marginTop: 12 }}>{titleExtra}</div>
</div>
}
style={{ width: width ? `${width}px` : 'auto', ...style }}
>
{children && <div className={clsx(bem(['split']))}></div>}
{children}
</Card>
);
};
4 changes: 4 additions & 0 deletions components/common/subqlTabs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: Apache-2.0

export * from './subqlTabs';
21 changes: 21 additions & 0 deletions components/common/subqlTabs/subqlTabs.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.subql-tabs {
.ant-tabs-tab {
color: var(--sq-gray500);
font-size: 18px;

& + .ant-tabs-tab {
margin: 0 0 0 24px;
}

&-btn {
display: inline-flex;
align-items: center;
}
}
.ant-tabs-ink-bar {
background: var(--sq-blue600);
}
.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: var(--sq-gray900);
}
}
Loading

0 comments on commit 45f5455

Please sign in to comment.