diff --git a/src/components/Image.astro b/src/components/Image.astro new file mode 100644 index 0000000..1d0ee35 --- /dev/null +++ b/src/components/Image.astro @@ -0,0 +1,30 @@ +--- +import cx from 'classnames'; +import { Image } from '@astrojs/image/components'; + +interface Props { + aspectRatio?: number | `${number}:${number}`; + alt?: string; + class?: string; + height?: number; + noMargin?: boolean; + src: string; + width: number; +} + +const { aspectRatio, alt, class: className, height, noMargin, src, width, ...props } = Astro.props; + +const classes = cx('image-shadow mbe-10 mbs-0', { 'mbe-0': noMargin }, className); +--- + +
+ {alt +
diff --git a/src/components/Image.tsx b/src/components/Image.tsx deleted file mode 100644 index 4bb9db4..0000000 --- a/src/components/Image.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import cx from 'classnames'; - -import type { FunctionalComponent } from 'preact'; - -interface Props { - alt: string; - class?: string; - noMargin?: boolean; - src: string; -} - -export const Image: FunctionalComponent = ({ - alt, - class: className, - noMargin, - src, - ...props -}) => { - const classes = cx('image-shadow mbe-10 mbs-0', { 'mbe-0': noMargin }, className); - - return ( -
- {alt} -
- ); -}; diff --git a/src/components/index.ts b/src/components/index.ts index 53ca855..39ff978 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,6 +1,7 @@ // @ts-nocheck import DownloadLink from './DownloadLink.astro'; import EmailLink from './EmailLink.astro'; +import Image from './Image.astro'; import MoreLink from './MoreLink.astro'; import Pagination from './Pagination.astro'; import ProjectContainer from './ProjectContainer.astro'; @@ -16,7 +17,6 @@ export * from './ColorSwatch'; export * from './Divider'; export * from './Flag'; export * from './Headline'; -export * from './Image'; export * from './LegalDate'; export * from './Link'; export * from './ListItem'; @@ -35,6 +35,7 @@ export * from './YouTubeVideo'; export { DownloadLink, EmailLink, + Image, MoreLink, Pagination, ProjectContainer,