Skip to content

Commit

Permalink
metadata value as component
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-moreno committed Jan 20, 2025
1 parent ab0bd66 commit f105962
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/experimental/Information/Headers/Metadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface MetadataProps {
items?: MetadataItem[]
}

function renderMetadataValue(item: MetadataItem) {
function MetadataValue({ item }: { item: MetadataItem }) {
switch (item.value.type) {
case "text":
return <span>{item.value.content}</span>
Expand All @@ -54,7 +54,6 @@ function renderMetadataValue(item: MetadataItem) {
function MetadataItem({ item }: { item: MetadataItem }) {
const [isActive, setIsActive] = useState(false)
const isAction = item.actions?.length
const metadataValue = renderMetadataValue(item)

return (
<div className="flex h-8 items-center gap-2">
Expand All @@ -76,7 +75,7 @@ function MetadataItem({ item }: { item: MetadataItem }) {
!isAction && "block"
)}
>
{metadataValue}
<MetadataValue item={item} />
</div>
{isAction && (
<div className="w-full md:hidden">
Expand All @@ -89,7 +88,7 @@ function MetadataItem({ item }: { item: MetadataItem }) {
})) ?? []
}
>
{metadataValue}
<MetadataValue item={item} />
</MobileDropdown>
</div>
)}
Expand All @@ -106,7 +105,7 @@ function MetadataItem({ item }: { item: MetadataItem }) {
transition={{ duration: 0.1 }}
>
<div className="flex h-5 items-center font-medium text-f1-foreground">
{metadataValue}
<MetadataValue item={item} />
</div>
{isAction && (
<motion.div
Expand Down

0 comments on commit f105962

Please sign in to comment.