import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
import { nothing } from 'lit';
import { defaultClasses, defaultStyles, iconSizeClass, onClickAction, textColorClass, textColorStyle, } from '../attributes.js';
import { blockTypeToString } from '../block-type.js';
import { resolveStyleColor } from './color.js';
import { classMap, resolveIcon } from './util.js';
export function renderIconBlock(block, ctx) {
    const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
    if (!block.config?.iconConfig) {
        console.error('Invalid block: Icon missing IconConfig');
        return nothing;
    }
    const { icon, size, color, colors } = block.config.iconConfig;
    const classes = {
        ...defaultClasses(block, ctx),
        ...textColorClass(),
        ...iconSizeClass(size),
    };
    const styles = {
        ...defaultStyles(block, ctx),
        ...textColorStyle(colors, color ?? 'neutral-content'),
    };
    const onClick = onClickAction(block, ctx);
    return html `<div
    class="${classMap(classes)}"
    style="${styleMap(styles)}"
    @click="${ifDefined(onClick)}"
    data-block-type="${blockTypeToString(block.type)}"
    ${resolveStyleColor(styles, 'color')}
  >
    ${resolveIcon(icon)}
  </div>`;
}
//# sourceMappingURL=renderIconBlock.js.map