Skip to content

Commit 7d0f957

Browse files
committed
Final test
1 parent 51f7c5a commit 7d0f957

File tree

12 files changed

+48
-49
lines changed

12 files changed

+48
-49
lines changed

.eslintrc.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
{
2-
"env": {
3-
"browser": true,
4-
"es2021": true
5-
},
6-
"extends": [
7-
"standard-with-typescript",
8-
"plugin:react/recommended",
9-
"prettier"
10-
],
11-
"parserOptions": {
12-
"ecmaVersion": "latest",
13-
"sourceType": "module"
14-
},
15-
"plugins": [
16-
"react"
17-
],
18-
"rules": {
19-
}
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"standard-with-typescript",
8+
"plugin:react/recommended",
9+
"prettier"
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"plugins": ["react"],
16+
"rules": {}
2017
}

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ const config: StorybookConfig = {
2020
autodocs: "tag",
2121
},
2222
};
23-
export default config;
23+
export default config;

.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ const preview: Preview = {
1212
},
1313
};
1414

15-
export default preview;
15+
export default preview;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@
6161
"lint-staged": {
6262
"*.js": "eslint --fix && npm run test",
6363
"*.{js,css,md,html,json}": "prettier --cache --write"
64-
}
64+
}
6565
}

src/components/Card/Card.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CardProps } from "./Card.types";
66
export default {
77
title: "Card",
88
component: Card,
9-
} as Meta;
9+
} as Meta;
1010

1111
const Template: Story<CardProps> = (args) => <Card {...args} />;
1212

src/components/HeroImage/HeroImage.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("HeroImage", () => {
1010
imageUrl="test.jpg"
1111
title="Test Title"
1212
subtitle="Test Subtitle"
13-
/>,
13+
/>
1414
);
1515
expect(getByText("Test Title")).toBeVisible();
1616
expect(getByText("Test Subtitle")).toBeVisible();
@@ -23,7 +23,7 @@ describe("HeroImage", () => {
2323
title="Test Title"
2424
subtitle="Test Subtitle"
2525
disabled
26-
/>,
26+
/>
2727
);
2828
const heroContainer = getByText("Test Title").parentElement;
2929
expect(heroContainer).toHaveStyle("background-color: darkgrey");
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import styled from "styled-components";
3-
import { HeroImageProps } from "./HeroImage.types";
1+
import React from 'react'
2+
import styled from 'styled-components'
3+
import { type HeroImageProps } from './HeroImage.types'
44

55
const HeroImageContainer = styled.div<HeroImageProps>`
66
background-image: url(${(props) => props.imageUrl});
@@ -14,28 +14,29 @@ const HeroImageContainer = styled.div<HeroImageProps>`
1414
text-align: center;
1515
position: relative;
1616
${(props) =>
17+
props.disabled !== undefined &&
1718
props.disabled &&
1819
`
1920
cursor: not-allowed;
2021
background: none;
2122
background-color: darkgrey;
2223
`}
23-
`;
24+
`
2425

2526
const Title = styled.h1`
2627
color: #fff;
27-
`;
28+
`
2829

2930
const Subtitle = styled.h2`
3031
color: #fff;
31-
`;
32+
`
3233

3334
const CallToActionButton = styled.button`
3435
padding: 10px 20px;
3536
margin-top: 20px;
3637
font-size: 16px;
3738
cursor: pointer;
38-
`;
39+
`
3940

4041
const HeroImage: React.FC<HeroImageProps> = ({
4142
imageUrl,
@@ -47,13 +48,14 @@ const HeroImage: React.FC<HeroImageProps> = ({
4748
}) => {
4849
return (
4950
<HeroImageContainer imageUrl={imageUrl} disabled={disabled}>
50-
{title && <Title>{title}</Title>}
51-
{subtitle && <Subtitle>{subtitle}</Subtitle>}
52-
{Text && (
53-
<CallToActionButton onClick={OnClick}>{Text}</CallToActionButton>
54-
)}
51+
{title ?? (false && <Title>{title}</Title>)}
52+
{subtitle ?? (false && <Subtitle>{subtitle}</Subtitle>)}
53+
{Text ??
54+
(false && (
55+
<CallToActionButton onClick={OnClick}>{Text}</CallToActionButton>
56+
))}
5557
</HeroImageContainer>
56-
);
57-
};
58+
)
59+
}
5860

59-
export default HeroImage;
61+
export default HeroImage

src/components/Img/Img.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
component: Img,
99
} as Meta<typeof Img>;
1010

11-
const Template: Story<ImgProps> = (args) => <Img {...args} />;
11+
const Template: Story<ImgProps> = (args) => <Img {...args} />;
1212

1313
export const Default = Template.bind({});
1414
Default.args = {

src/components/Img/Img.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { render, screen } from "@testing-library/react";
44
import Img from "./Img";
55

66
describe("Img", () => {
7-
it("renders the component", () => {
7+
it("renders the component", () => {
88
const { getByAltText } = render(<Img src="test.jpg" alt="Test" />);
99
expect(getByAltText("Test")).toBeVisible();
10-
});
10+
});
1111

12-
it("changes opacity when disabled", () => {
12+
it("changes opacity when disabled", () => {
1313
const { getByAltText } = render(<Img src="test.jpg" alt="Test" disabled />);
1414
expect(getByAltText("Test")).toHaveStyle("opacity: 0.5");
15-
});
15+
});
1616
});

src/components/Img/Img.types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ export interface ImgProps {
33
alt?: string;
44
width?: string;
55
height?: string;
6-
disabled?: boolean;
6+
disabled?: boolean;
77
}

0 commit comments

Comments
 (0)