-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
const color_classes = { | ||
"default": "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300", | ||
"danger": "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300", | ||
"success": "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300", | ||
"warning": "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300" | ||
} | ||
/* | ||
* provides a badge that may have different colors | ||
*/ | ||
export const Badge = ({ children, color="default" }) => ( | ||
<div className={"text-xs inline-block font-medium me-2 px-2.5 py-1 rounded-full " + color_classes[color] }> | ||
{children} | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,53 @@ | ||
// Copyright DB InfraGO AG and contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export const TemplateCard = ({ template, onClickCallback }) => ( | ||
import { FlaskConical, TriangleAlert, Book, FileStack } from "lucide-react"; | ||
import { Badge } from "./Badge"; | ||
|
||
/** | ||
* TemplateCard shall introduce the template to the user and provide some basic insights: | ||
* - is this a template of a model element or a document | ||
* - is it a stable template or an experimental thing / not for production | ||
* - how many object / document instances this template applies to | ||
* - indicate if the template is broken / cant enumerate objects / other issues | ||
* - maybe indicate modeling rules compliance score | ||
*/ | ||
export const TemplateCard = ({ | ||
name, | ||
description, | ||
idx, | ||
onClickCallback, | ||
isDocument=false, | ||
isExperimental=false, | ||
instances=0, | ||
isBroken=false, | ||
errorMessage="" | ||
}) => ( | ||
<div | ||
onClick={() => onClickCallback(template.idx)} | ||
onClick={() => onClickCallback(idx)} | ||
className={ | ||
'm-2 mt-6 max-w-sm cursor-pointer rounded-lg bg-gray-200 shadow-md ' + | ||
'hover:bg-custom-light dark:bg-custom-dark-2 dark:shadow-dark ' + | ||
'dark:hover:bg-custom-dark-4' | ||
}> | ||
<div className="p-5"> | ||
<h5 | ||
className={ | ||
'mb-2 text-2xl font-normal text-gray-900 dark:text-gray-100' | ||
}> | ||
{template.name} | ||
</h5> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-300"> | ||
{template.description} | ||
<div className="flex flex-row justify-between"> | ||
<h5 | ||
className={ | ||
'mb-2 text-2xl font-normal text-left text-gray-900 dark:text-gray-100' | ||
} style={{ overflowWrap: "break-word" }} > | ||
{name} | ||
</h5> | ||
{instances > 0 && <span className="ml-0.5"><FileStack size={16} style={{display: "inline-block"}}/> {instances}</span>} | ||
</div> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-300 text-left"> | ||
{description} | ||
</p> | ||
<div className={"text-left"}> | ||
{isBroken && <Badge color={"danger"}><TriangleAlert size={16} style={{display: "inline-block"}}/> Broken</Badge>} | ||
{isExperimental && <Badge color={"warning"}><FlaskConical size={16} style={{display: "inline-block"}}/> Experimental</Badge>} | ||
{isDocument && <Badge><Book size={16} style={{display: "inline-block"}}/> Document</Badge>} | ||
</div> | ||
</div> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters