Skip to content

Commit a065752

Browse files
author
Tiko
committed
fixed props from ContentPageheader
1 parent c1b0653 commit a065752

File tree

7 files changed

+45
-98
lines changed

7 files changed

+45
-98
lines changed

src/components/ArrowButton.tsx

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/components/Button.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,47 @@ import { Link } from 'gatsby';
44
import theme from '../styles/theme';
55
import { ButtonProps } from './Button.types';
66

7-
// TODO: find a way to use both ...props and typescript
87
const ButtonBase: React.FC<ButtonProps> = ({
98
href,
109
useGatsbyLink = false,
1110
className = '',
1211
rel,
13-
type,
12+
submit,
1413
target,
1514
onClick,
1615
children,
1716
}) => {
1817
if (useGatsbyLink) {
18+
if (href) {
19+
return (
20+
<Link
21+
to={href}
22+
className={`button ${className}`}
23+
rel={rel}
24+
target={target}
25+
onClick={onClick}
26+
>
27+
{children}
28+
</Link>
29+
);
30+
}
31+
}
32+
if (submit) {
1933
return (
20-
<Link
21-
to={href}
34+
<button
2235
className={`button ${className}`}
23-
rel={rel}
24-
type={type}
25-
target={target}
36+
type="submit"
2637
onClick={onClick}
2738
>
2839
{children}
29-
</Link>
40+
</button>
3041
);
3142
}
3243
return (
3344
<a
3445
href={href}
3546
className={`button ${className}`}
3647
rel={rel}
37-
type={type}
3848
target={target}
3949
onClick={onClick}
4050
>

src/components/Button.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface ButtonProps {
55
useGatsbyLink?: boolean;
66
className?: string;
77
rel?: string;
8-
type?: string;
8+
submit?: boolean;
99
target?: string;
1010
onClick?: () => void;
1111
children: React.ReactNode;

src/containers/ContactForm/ContactForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class ContactForm extends React.Component<{}, ContactFormState> {
179179
/>
180180

181181
<SendButton
182-
type="submit"
182+
submit
183183
onClick={() =>
184184
this.handleFormSubmit(this.state.formValues)
185185
}

src/containers/ContentPageHeader/ContentPageHeader.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
/* eslint-disable react/jsx-props-no-spreading */
21
import React from 'react';
32
import TextBlock from '../TextBlock/TextBlock';
43
import { MainHeader, MainHeaderContent } from './ContentPageHeader.components';
54

6-
// eslint-disable-next-line no-unused-vars
75
interface Props {
8-
subtitle?: string;
9-
title?: string;
10-
button?: string;
11-
href?: string;
12-
text?: React.ReactNode;
6+
subtitle: string;
7+
title: string;
8+
button: string;
9+
href: string;
10+
text: string;
1311
useGatsbyLink?: boolean;
12+
img: string;
13+
hero?: boolean;
14+
shadow?: boolean;
1415
}
1516

16-
// TODO: find a way to pass ...props in TypeScript
17-
const ContentPageHeader: React.FC<any> = ({
18-
subtitle = '',
19-
title = '',
20-
button = '',
21-
href = '',
22-
text = '',
23-
useGatsbyLink = false,
24-
...props
17+
const ContentPageHeader: React.FC<Props> = ({
18+
subtitle,
19+
title,
20+
button,
21+
href,
22+
text,
23+
useGatsbyLink,
24+
img,
25+
hero,
26+
shadow,
2527
}) => {
2628
return (
27-
<MainHeader {...props}>
29+
<MainHeader img={img} shadow={shadow} hero={hero}>
2830
<MainHeaderContent>
2931
<TextBlock
3032
useGatsbyLink={useGatsbyLink}

src/containers/Credits/Credits.components.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import theme from '../../styles/theme';
4-
import ArrowButton from '../../components/ArrowButton';
4+
import Button from '../../components/Button';
55

66
const { mediaQueryMin } = theme;
77
export const CreditsContainer = styled.div`
@@ -72,9 +72,7 @@ export const CreditItemWithLinks: React.FC<CreditItemWithLinksProps> = ({
7272
<>
7373
<CreditText>{credit}</CreditText>
7474
<CreditText>
75-
<ArrowButton href={links[index]}>
76-
Ga naar pagina
77-
</ArrowButton>
75+
<Button href={links[index]}>Ga naar pagina</Button>
7876
</CreditText>
7977
</>
8078
))}

src/containers/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import theme from '../styles/theme';
4-
import ArrowButton from '../components/ArrowButton';
4+
import Button from '../components/Button';
55

66
const { colors, mediaQueryMin, containerWidth } = theme;
77

@@ -113,9 +113,9 @@ const Header: React.FC<HeaderProps> = ({
113113
<Text>{tagline || text}</Text>
114114
{children}
115115
{href && (
116-
<ArrowButton useGatsbyLink={useGatsbyLink} href={href}>
116+
<Button useGatsbyLink={useGatsbyLink} href={href}>
117117
{button || 'Lees meer'}
118-
</ArrowButton>
118+
</Button>
119119
)}
120120
</div>
121121
</HeaderInformation>

0 commit comments

Comments
 (0)