From 898f38b27fc018b9801f211700e1e2e71aa76ad3 Mon Sep 17 00:00:00 2001 From: Nick Ovchinnikov Date: Fri, 18 Mar 2022 18:21:22 +0400 Subject: [PATCH] Add tile component --- README.md | 8 ++++ components/Button/Button.stories.tsx | 1 - components/Button/Button.tsx | 4 +- .../Button/__snapshots__/Button.test.tsx.snap | 2 +- components/Tile/Tile.stories.tsx | 47 +++++++++++++++++++ components/Tile/Tile.test.tsx | 19 ++++++++ components/Tile/Tile.tsx | 24 ++++++++++ .../Tile/__snapshots__/Tile.test.tsx.snap | 14 ++++++ components/styles.ts | 4 ++ styles/themes.ts | 4 +- 10 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 components/Tile/Tile.stories.tsx create mode 100644 components/Tile/Tile.test.tsx create mode 100644 components/Tile/Tile.tsx create mode 100644 components/Tile/__snapshots__/Tile.test.tsx.snap diff --git a/README.md b/README.md index 7ad9e51..a261b1f 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ [pull request](https://github.com/nickovchinnikov/coursesbox/pull/4) + ## React and Typescript Review ### JSX at Glance @@ -51,3 +52,10 @@ ### Visual testing and Chromatic [pull request](https://github.com/nickovchinnikov/coursesbox/pull/10) + + +## Storybook and Components Library + +### Tile component + +[pull request](https://github.com/nickovchinnikov/coursesbox/pull/11) diff --git a/components/Button/Button.stories.tsx b/components/Button/Button.stories.tsx index 4859c94..836b5f0 100644 --- a/components/Button/Button.stories.tsx +++ b/components/Button/Button.stories.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { ComponentStoryObj, ComponentMeta } from "@storybook/react"; import { expect } from "@storybook/jest"; import { screen, userEvent } from "@storybook/testing-library"; diff --git a/components/Button/Button.tsx b/components/Button/Button.tsx index 8cb28b0..5b08652 100644 --- a/components/Button/Button.tsx +++ b/components/Button/Button.tsx @@ -3,7 +3,7 @@ import styled from "@emotion/styled"; import { css, SerializedStyles } from "@emotion/react"; import { AppTheme } from "@/styles/themes"; -import { boxShadow, transition } from "@/components/styles"; +import { boxShadow, transition, borderRadius } from "@/components/styles"; export type Color = "primary" | "secondary" | "danger" | "warning"; @@ -46,7 +46,7 @@ export const Button = styled.button` font-size: 1.6rem; width: 15rem; height: 4rem; - border-radius: 1rem; + ${borderRadius}; ${({ theme, color }) => getColors(theme, color)}; &:hover { opacity: 0.9; diff --git a/components/Button/__snapshots__/Button.test.tsx.snap b/components/Button/__snapshots__/Button.test.tsx.snap index 7f63928..661f63b 100644 --- a/components/Button/__snapshots__/Button.test.tsx.snap +++ b/components/Button/__snapshots__/Button.test.tsx.snap @@ -3,7 +3,7 @@ exports[`Button test cases Render check 1`] = `