diff --git a/src/components/Image.tsx b/src/components/Image.tsx index 9fe67a9..95c6499 100644 --- a/src/components/Image.tsx +++ b/src/components/Image.tsx @@ -1,13 +1,40 @@ +import ImageStyle from "@/styles/Image.module.sass" +import Link from "./Link"; +// const regex = /@(?\w*)@(?\w*\S*)/gm; + const Image = ({ src, alt }: { src: string, alt: string }) => { - return ( -
- {alt} -
- ); + const regex = /@(?\w+)@(?\w{2,}\.[a-z]{2,10})/gm; + if (alt.match(regex)) { + const newAlt = alt.replace("art by", "") + const sub = "https://$/@$"; + const link = newAlt.replace(regex, sub); + return ( +
+ {alt} + art by +
+ ) + } + + else { + + return ( +
+ {alt} + {alt} + +
+ ); + } }; export default Image; \ No newline at end of file