mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 06:38:46 +00:00
Refactored information widgets, improve widget-boxed style
Signed-off-by: Denis Papec <denis.papec@gmail.com>
This commit is contained in:
parent
c79d45f91e
commit
d4fd923be5
37 changed files with 701 additions and 858 deletions
28
src/components/widgets/widget/single_resource.jsx
Normal file
28
src/components/widgets/widget/single_resource.jsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import UsageBar from "../resources/usage-bar";
|
||||
|
||||
import WidgetIcon from "./widget_icon";
|
||||
import ResourceValue from "./resource_value";
|
||||
import ResourceLabel from "./resource_label";
|
||||
import Raw from "./raw";
|
||||
|
||||
export default function SingleResource({ children, key, expanded = false }) {
|
||||
const values = children.filter(child => child.type === ResourceValue);
|
||||
const labels = children.filter(child => child.type === ResourceLabel);
|
||||
|
||||
return <div key={key} className="flex-none flex flex-row items-center mr-3 py-1.5">
|
||||
{children.find(child => child.type === WidgetIcon)}
|
||||
<div className="flex flex-col ml-3 text-left min-w-[85px]">
|
||||
<div className="text-theme-800 dark:text-theme-200 text-xs flex flex-row justify-between">
|
||||
{values.pop()}
|
||||
{labels.pop()}
|
||||
</div>
|
||||
{ expanded && <div className="text-theme-800 dark:text-theme-200 text-xs flex flex-row justify-between">
|
||||
{values.pop()}
|
||||
{labels.pop()}
|
||||
</div>
|
||||
}
|
||||
{children.find(child => child.type === UsageBar)}
|
||||
</div>
|
||||
{children.find(child => child.type === Raw)}
|
||||
</div>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue