-
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: add mana dropdown to the output page
- Loading branch information
Showing
7 changed files
with
131 additions
and
9 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,40 @@ | ||
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 }: IKeyValue): React.JSX.Element { | ||
return ( | ||
<> | ||
{value !== undefined && value !== null && ( | ||
<div className="key-value"> | ||
<div className="entry--key">{label}</div> | ||
<div className="entry--value">{value}</div> | ||
</div> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default function KeyValueEntries({ label, value, entries }: IKeyValueEntries): React.JSX.Element { | ||
const [isExpanded, setIsExpanded] = useState<boolean>(false); | ||
|
||
return ( | ||
<div className="key-value-wrapper"> | ||
<div className="key-value--row" onClick={() => setIsExpanded(!isExpanded)}> | ||
<div className={classNames("margin-r-t", "card--content--dropdown", { opened: isExpanded })}> | ||
<DropdownIcon /> | ||
</div> | ||
<KeyValuePair label={label} value={value} /> | ||
</div> | ||
|
||
{entries && entries.length > 0 && isExpanded && ( | ||
<div className="key-value-entries 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,8 @@ | ||
export interface IKeyValue { | ||
label: string; | ||
value: string | number | null | undefined; | ||
} | ||
|
||
export interface IKeyValueEntries extends IKeyValue { | ||
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