style: dashboard style

This commit is contained in:
jialin
2024-06-19 18:58:49 +08:00
parent 9f34452c68
commit 8c402e88fb
24 changed files with 266 additions and 189 deletions
+5 -1
View File
@@ -29,14 +29,18 @@ const GaugeChart: React.FC<GaugeChartProps> = (props) => {
range: rangColor
}
},
startAngle: Math.PI,
endAngle: 0,
title: {
// title,
title,
size: 0,
titleFontSize: 14,
style: {
align: 'center'
}
},
style: {
arcShape: 'round',
textContent: (target: number, total: number) => {
return `${(target / total) * 100}%`;
}
+37
View File
@@ -0,0 +1,37 @@
import { Pie } from '@ant-design/plots';
import numeral from 'numeral';
interface PieChartProps {
data: { label: string; value: number }[];
height?: number;
radius?: number;
}
const PieChart: React.FC<PieChartProps> = (props) => {
const { data, height = 340, radius = 0.9 } = props;
return (
<Pie
height={height}
radius={radius}
angleField="value"
colorField="label"
data={data}
legend={{
color: {
position: 'bottom',
layout: {
justifyContent: 'center'
}
}
}}
label={{
position: 'outside',
text: (item: { label: number; value: number }) => {
return `${item.label}: ${numeral(item.value).format('0,0')}`;
}
}}
/>
);
};
export default PieChart;
+14 -4
View File
@@ -6,17 +6,27 @@ type PageToolsProps = {
right?: React.ReactNode;
marginBottom?: number;
marginTop?: number;
style?: React.CSSProperties;
};
const PageTools: React.FC<PageToolsProps> = (props) => {
const { left, right, marginBottom = 0, marginTop = 70 } = props;
const {
left,
right,
marginBottom = 0,
marginTop = 70,
style: pageStyle
} = props;
const newStyle: Record<string, string> = useMemo(() => {
const style: Record<string, string> = {};
const newStyle: React.CSSProperties = useMemo(() => {
const style: React.CSSProperties = {};
style.marginBottom = `${marginBottom}px`;
style.marginTop = `${marginTop}px`;
if (pageStyle) {
Object.assign(style, pageStyle);
}
return style;
}, [marginBottom, marginTop]);
}, [marginBottom, marginTop, pageStyle]);
return (
<div className="page-tools" style={newStyle}>
+4
View File
@@ -11,6 +11,10 @@
font-size: var(--font-size-base);
overflow: hidden;
&.download {
background-color: rgb(47 191 133 / 30%);
}
.download {
display: flex;
justify-content: center;
+3 -1
View File
@@ -48,7 +48,9 @@ const StatusTag: React.FC<StatusTagProps> = ({ statusValue, download }) => {
};
return (
<span
className={classNames('status-tag')}
className={classNames('status-tag', {
download: download?.percent
})}
style={
download
? {