import { __ } from '@wordpress/i18n'; import { colord, AnyColor } from 'colord'; import { Attributes } from '../../../types'; import { findBackgroundColor } from '../../../util/colors'; export const BlockLeft = ( attributes: Partial & { context?: string }, ) => { const { bgColor, textColor, seeMoreString, disablePadding, context, footerType, seeMoreCollapse, seeMoreCollapseString, } = attributes; let backgroundColor = colord(bgColor as AnyColor).toHex(); const textC = colord(textColor as AnyColor); let color = textC.isDark() ? textC.lighten(0.05).toHex() : textC.darken(0.05).toHex(); const hasFooter = footerType !== 'none'; const inEditor = context === 'editor'; const seeMore = seeMoreString || __('Expand', 'code-block-pro'); if (bgColor?.startsWith('var(')) { backgroundColor = findBackgroundColor(attributes) ?? bgColor; } if (textColor?.startsWith('var(')) { color = textColor; } return (
{/* span is used to avoid theme button styling */} {seeMore}
); };