mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(app): redesign dashboard-item component [EE-3634] (#7175)
This commit is contained in:
parent
a66fd78dc1
commit
8bf1c91bc9
15 changed files with 236 additions and 248 deletions
3
app/react/components/DashboardItem/DashboardGrid.css
Normal file
3
app/react/components/DashboardItem/DashboardGrid.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.dashboard-grid {
|
||||
@apply grid grid-cols-2 gap-3;
|
||||
}
|
7
app/react/components/DashboardItem/DashboardGrid.tsx
Normal file
7
app/react/components/DashboardItem/DashboardGrid.tsx
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { PropsWithChildren } from 'react';
|
||||
|
||||
import './DashboardGrid.css';
|
||||
|
||||
export function DashboardGrid({ children }: PropsWithChildren<unknown>) {
|
||||
return <div className="dashboard-grid">{children}</div>;
|
||||
}
|
|
@ -34,3 +34,11 @@ export function WithLink() {
|
|||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export function WithChildren() {
|
||||
return (
|
||||
<DashboardItem value={1} icon="fa fa-th-list" type="Example resource">
|
||||
<div>Children</div>
|
||||
</DashboardItem>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ReactNode } from 'react';
|
||||
import clsx from 'clsx';
|
||||
|
||||
import { Icon, IconProps } from '@/react/components/Icon';
|
||||
|
||||
import { Widget, WidgetBody } from '@@/Widget';
|
||||
import { pluralize } from '@/portainer/helpers/strings';
|
||||
|
||||
interface Props extends IconProps {
|
||||
value?: number;
|
||||
|
@ -18,21 +18,29 @@ export function DashboardItem({
|
|||
featherIcon,
|
||||
}: Props) {
|
||||
return (
|
||||
<div className="col-sm-12 col-md-6" aria-label={type}>
|
||||
<Widget>
|
||||
<WidgetBody>
|
||||
<div className="widget-icon blue pull-left">
|
||||
<Icon icon={icon} feather={featherIcon} />
|
||||
<div
|
||||
className={clsx(
|
||||
'border-solid rounded-lg border-2 hover:border-2 border-gray-5 hover:border-blue-7',
|
||||
'bg-gray-2 hover:bg-blue-2',
|
||||
'p-3'
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center" aria-label={type}>
|
||||
<div className="icon-badge text-2xl bg-blue-3 text-blue-8 mr-4">
|
||||
<Icon icon={icon} feather={featherIcon} className="feather" />
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col justify-around">
|
||||
<div className="text-gray-9 font-medium text-2xl" aria-label="value">
|
||||
{typeof value !== 'undefined' ? value : '-'}
|
||||
</div>
|
||||
<div className="pull-right">{children}</div>
|
||||
<div className="title" aria-label="value">
|
||||
{value}
|
||||
<div className="text-gray-7 text-xl" aria-label="resourceType">
|
||||
{pluralize(value || 0, type)}
|
||||
</div>
|
||||
<div className="comment" aria-label="resourceType">
|
||||
{type}
|
||||
</div>
|
||||
</WidgetBody>
|
||||
</Widget>
|
||||
</div>
|
||||
|
||||
<div className="ml-auto">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue