Skip to content

Commit

Permalink
fix: remove size and wieght default value
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Mar 11, 2022
1 parent 21606b0 commit 8c10a8b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`mount and unmount component could be updated and unmounted without errors 1`] = `
<DocumentFragment>
<p
class="container-0-2-17 text-0-2-13 regular-0-2-4"
dir="auto"
/>
</DocumentFragment>
`;

exports[`mount and unmount component could be updated and unmounted without errors 2`] = `
<DocumentFragment>
<p
class="container-0-2-17 text-0-2-13 regular-0-2-4"
dir="auto"
style="font-size: 16px;"
/>
</DocumentFragment>
`;

exports[`mount and unmount component could be updated and unmounted without errors 3`] = `
<DocumentFragment>
<p
class="container-0-2-17 text-0-2-13 regular-0-2-4"
dir="auto"
/>
</DocumentFragment>
`;

exports[`mount and unmount component could be updated and unmounted without errors 4`] = `
<DocumentFragment>
<p
class="container-0-2-17 text-0-2-13 regular-0-2-4"
dir="auto"
style="font-size: 14px;"
/>
</DocumentFragment>
`;
5 changes: 3 additions & 2 deletions src/component/src/molecules/text/__tests__/mount.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mountTest } from "reactjs-view-tests";
import { shotTest } from "reactjs-view-tests";
import { Text } from "../";

mountTest(Text);
shotTest(Text, { size: 16 });
shotTest(Text, { size: "small" });
10 changes: 6 additions & 4 deletions src/component/src/molecules/text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ const Text = React.memo(
className,
color,
style,
size = "medium",
weight = "medium",
size,
weight,
variant,
...rest
},
ref,
) => {
const themes = useThemes();
const fontSize = typeof size === "number" ? size : fontSizes[size];

const fontSize = typeof size === "string" ? fontSizes[size] : size;

const fontWeight =
typeof weight === "number" ? weight : fontWeights[weight];
typeof weight === "string" ? fontWeights[weight] : weight;

const setVariant = (): Variant => {
if (typeof size !== "number" && size?.match(/h(1|2|3|4|5|6)/g)) {
Expand Down

0 comments on commit 8c10a8b

Please sign in to comment.