import {createMemo, For} from 'solid-js'; import {parseMarkdown} from '../../markdown'; import { getLayerStyle } from './hooks/dimensions'; import type { CardData, CardSide } from './types'; import {DeckStore} from "./hooks/deckStore"; import {processVariables} from "../utils/csv-loader"; import {resolvePath} from "../utils/path"; export interface CardLayerProps { cardData: CardData; store: DeckStore; side?: CardSide; } export function CardLayer(props: CardLayerProps) { const side = () => props.side || 'front'; const layers = createMemo(() => side() === 'front' ? props.store.state.frontLayerConfigs.filter((l) => l.visible) : props.store.state.backLayerConfigs.filter((l) => l.visible) ); const dimensions = () => props.store.state.dimensions!; const showBounds = () => props.store.state.isEditing; function renderLayerContent(content: string) { const iconPath = resolvePath(props.store.state.cards.sourcePath, props.cardData.iconPath ?? "./assets"); return parseMarkdown(processVariables(content, props.cardData, props.store.state.cards), iconPath) as string; } return ( {(layer) => { return ( <>
{showBounds() && (
)} ); }} ); }