---
import type { LismProps } from '../types';
import { defaultProps } from '../../../dist/components/Modal/getProps';
import { Lism } from '../Lism';
import { Icon } from '../Icon';

// Propsの定義
interface Props extends LismProps {}
const { modalId = '', icon, srText = 'Close', ...props } = Astro.props || {};
const hasSlot = Astro.slots.has('default');
---

<Lism data-modal-close={modalId} {...defaultProps.closeBtn} {...props}>
	{
		hasSlot ? (
			<slot />
		) : (
			<>
				<Icon icon={icon || 'x'} />
				<span class='u--hidden'>{srText || 'Close'}</span>
			</>
		)
	}
</Lism>
