refactor(starter): upgrade and move to typescript

This commit is contained in:
Alexander Shelepenok
2022-04-16 14:25:55 +00:00
parent 67ebabbaac
commit 50a99f57f7
156 changed files with 5350 additions and 7173 deletions

View File

@@ -1,6 +1,6 @@
.icon {
display: inline-block;
fill: currentColor;
fill: currentcolor;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-style: normal;
@@ -8,10 +8,8 @@
font-weight: normal;
height: 1em;
line-height: 1em;
margin-left: 0.2em;
margin-right: 0.2em;
speak: none;
stroke: currentColor;
stroke: currentcolor;
stroke-width: 0;
text-align: center;
text-transform: none;

View File

@@ -2,17 +2,13 @@ import React from "react";
import renderer from "react-test-renderer";
import { Icon } from "@/components/Icon";
import { ICONS } from "@/constants";
import { getIcon } from "@/utils";
describe("Icon", () => {
const props = {
name: "test",
icon: {
viewBox: "0 0 0 0",
path: "",
},
};
it("renders correctly", () => {
const [github] = Object.keys(ICONS) as Array<keyof typeof ICONS>;
const props = { name: github, icon: getIcon(github) };
const tree = renderer.create(<Icon {...props} />).toJSON();
expect(tree).toMatchSnapshot();
});

View File

@@ -1,12 +1,14 @@
import React from "react";
import styles from "./Icon.module.scss";
import { ICONS } from "@/constants";
import * as styles from "./Icon.module.scss";
interface Props {
name: string;
name: keyof typeof ICONS;
icon: {
path?: string;
viewBox?: string;
path?: string;
};
}

View File

@@ -2,14 +2,13 @@
exports[`Icon renders correctly 1`] = `
<svg
className="icon"
viewBox="0 0 0 0"
viewBox="0 0 26 28"
>
<title>
test
github
</title>
<path
d=""
d="M10 19c0 1.141-0.594 3-2 3s-2-1.859-2-3 0.594-3 2-3 2 1.859 2 3zM20 19c0 1.141-0.594 3-2 3s-2-1.859-2-3 0.594-3 2-3 2 1.859 2 3zM22.5 19c0-2.391-1.453-4.5-4-4.5-1.031 0-2.016 0.187-3.047 0.328-0.812 0.125-1.625 0.172-2.453 0.172s-1.641-0.047-2.453-0.172c-1.016-0.141-2.016-0.328-3.047-0.328-2.547 0-4 2.109-4 4.5 0 4.781 4.375 5.516 8.188 5.516h2.625c3.813 0 8.188-0.734 8.188-5.516zM26 16.25c0 1.734-0.172 3.578-0.953 5.172-2.063 4.172-7.734 4.578-11.797 4.578-4.125 0-10.141-0.359-12.281-4.578-0.797-1.578-0.969-3.437-0.969-5.172 0-2.281 0.625-4.438 2.125-6.188-0.281-0.859-0.422-1.766-0.422-2.656 0-1.172 0.266-2.344 0.797-3.406 2.469 0 4.047 1.078 5.922 2.547 1.578-0.375 3.203-0.547 4.828-0.547 1.469 0 2.953 0.156 4.375 0.5 1.859-1.453 3.437-2.5 5.875-2.5 0.531 1.062 0.797 2.234 0.797 3.406 0 0.891-0.141 1.781-0.422 2.625 1.5 1.766 2.125 3.938 2.125 6.219z"
/>
</svg>
`;