-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(webui): add property summary
- Loading branch information
Showing
4 changed files
with
66 additions
and
75 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import cn from 'classnames'; | ||
import { Children, ReactNode, type PropsWithChildren } from 'react'; | ||
|
||
/** | ||
* Render various properties or attributes of a certain entity. | ||
* This renders each of these properties with a separator in between. | ||
*/ | ||
export function PropertySummary( | ||
props: PropsWithChildren<{ className?: string; prefix?: ReactNode }> | ||
) { | ||
return ( | ||
<div className={cn('inline font-sm text-secondary', props.className)}> | ||
{props.prefix} | ||
{Children.map(props.children, (child, index) => { | ||
if (index === 0) return child; | ||
if (!child) return null; | ||
return ( | ||
<> | ||
<span className="text-tertiary mx-2 select-none">-</span> | ||
{child} | ||
</> | ||
); | ||
})} | ||
</div> | ||
); | ||
} |