mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
* Refactor Layer and its subcomponents, replacing cloneElement by context * Add showcase for PopupButton template component * Templateify exported elements (WIP) * Remove unused file * Export templateified PopupStartEndInput * Fix template component type * Change folder structure * Lower test coverage * changed export name * Refactor PopupForm and PopupView * More refactoring * Add provider for PopupFormContext * Fix popupform title * Add comments * Use correct ItemFormPopup for new items * Fix linting * Reduce coverage * Change tailwind prefix * Fix type --------- Co-authored-by: Anton Tranelis <mail@antontranelis.de> Co-authored-by: Anton Tranelis <31516529+antontranelis@users.noreply.github.com>
33 lines
736 B
TypeScript
33 lines
736 B
TypeScript
import { get } from 'radash'
|
|
|
|
import { TextView } from '#components/Map/Subcomponents/ItemPopupComponents'
|
|
|
|
import type { Item } from '#types/Item'
|
|
|
|
export const ProfileTextView = ({
|
|
item,
|
|
dataField = 'text',
|
|
heading,
|
|
hideWhenEmpty,
|
|
}: {
|
|
item: Item
|
|
dataField: string
|
|
heading: string
|
|
hideWhenEmpty: boolean
|
|
}) => {
|
|
const text = get(item, dataField)
|
|
|
|
const parsedText = typeof text !== 'string' ? '' : text
|
|
|
|
return (
|
|
<div className='tw:my-10 tw:mt-2 tw:px-6'>
|
|
{!(text === '' && hideWhenEmpty) && (
|
|
<h2 className='tw:text-lg tw:font-semibold'>{heading}</h2>
|
|
)}
|
|
<div className='tw:mt-2 tw:text-sm'>
|
|
<TextView itemId={item.id} rawText={parsedText} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|