-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate mana into output page (#1146)
* feat: add mana dropdown to the output page * chore: remove debris * feat: improve key value pair component --------- Co-authored-by: Mario <[email protected]> Co-authored-by: Begoña Alvarez <[email protected]>
- Loading branch information
1 parent
3d3bb50
commit 107e9a1
Showing
7 changed files
with
105 additions
and
46 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,49 @@ | ||
import classNames from "classnames"; | ||
import React, { useState } from "react"; | ||
import { IKeyValue, IKeyValueEntries } from "~/app/lib/interfaces"; | ||
import DropdownIcon from "~assets/dropdown-arrow.svg?react"; | ||
|
||
function KeyValuePair({ label, value, orientation }: IKeyValue): React.JSX.Element { | ||
return ( | ||
<> | ||
{value !== undefined && value !== null && ( | ||
<> | ||
<div className="card--label">{label}</div> | ||
<div | ||
className={classNames( | ||
"card--value", | ||
"row", | ||
{ "margin-b-0": orientation === "row" }, | ||
{ "padding-l-8": orientation === "row" }, | ||
)} | ||
> | ||
{value} | ||
</div> | ||
</> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default function KeyValueEntries({ isPreExpanded, label, value, entries }: IKeyValueEntries): React.JSX.Element { | ||
const [isExpanded, setIsExpanded] = useState<boolean>(isPreExpanded ?? false); | ||
|
||
return ( | ||
<div> | ||
<div className="card--content__input card--value row middle" onClick={() => setIsExpanded(!isExpanded)}> | ||
<div className={classNames("margin-r-t", "card--content--dropdown", { opened: isExpanded })}> | ||
<DropdownIcon /> | ||
</div> | ||
<KeyValuePair label={label} value={value} orientation="row" /> | ||
</div> | ||
|
||
{entries && entries.length > 0 && isExpanded && ( | ||
<div className="padding-l-t left-border"> | ||
{entries.map((entry, idx) => ( | ||
<KeyValuePair key={idx} {...entry} /> | ||
))} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./routes.interfaces"; | ||
export * from "./key-value.interfaces"; |
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,10 @@ | ||
export interface IKeyValue { | ||
orientation?: "row" | "column"; | ||
label: string; | ||
value: string | number | null | undefined; | ||
} | ||
|
||
export interface IKeyValueEntries extends IKeyValue { | ||
isPreExpanded?: boolean; | ||
entries?: IKeyValue[]; | ||
} |
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