refactor: add typescript definition and fix some type error

This commit is contained in:
HD
2022-06-23 22:58:13 +08:00
parent b66919114d
commit e0bbbf4f30
39 changed files with 640 additions and 324 deletions
+11 -4
View File
@@ -1,4 +1,4 @@
import React from "react";
import React, { FC } from "react";
import styled from "styled-components";
const Styled = styled.div`
@@ -11,11 +11,18 @@ const Styled = styled.div`
}
`;
export default function Image({ url = "" }) {
interface Props {
url: string;
alt?: string;
}
const Image: FC<Props> = ({ url, alt }) => {
if (!url) return null;
return (
<Styled>
<img src={url} />
<img src={url} alt={alt} />
</Styled>
);
}
};
export default Image;