import { __ } from '@wordpress/i18n'; import { colord, AnyColor } from 'colord'; import { Attributes } from '../../../types'; import { findBackgroundColor, findTextColor } from '../../../util/colors'; export const RoundCenter = ( attributes: Partial & { context?: string }, ) => { const { bgColor, textColor, seeMoreString, context, footerType } = attributes; let bgTop, color, bg; if (bgColor?.startsWith('var(')) { bgTop = findBackgroundColor(attributes) ?? bgColor; bg = bgTop; color = findTextColor(attributes) ?? textColor; } else { const bgC = colord(bgColor as AnyColor); const textC = colord(textColor as AnyColor); color = bgC.isDark() ? textC.lighten(0.15).toHex() : textC.darken(0.15).toHex(); bg = bgC.isDark() ? bgC.lighten(0.1).toHex() : bgC.darken(0.1).toHex(); bgTop = bgC.toHex(); } const hasFooter = footerType !== 'none'; const inEditor = context === 'editor'; return (
{/* bg 50% height at top */} {!hasFooter && ( ); };