Skip to content

Commit d212a89

Browse files
committed
feat: add main image component
1 parent b21d490 commit d212a89

File tree

5 files changed

+259
-0
lines changed

5 files changed

+259
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react";
2+
import MainImage from ".";
3+
4+
export default {
5+
title: "Components/MainImage",
6+
component: MainImage,
7+
};
8+
9+
const Template = (args) => <MainImage {...args} />;
10+
11+
export const Default = Template.bind({});
12+
13+
Default.args = {
14+
backgroundImage: `https://images.unsplash.com/photo-1613487957484-32c977a8bd62?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1400&h=640&q=80`,
15+
};

src/components/MainImage/index.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Typography } from "@mui/material";
2+
import { useStyles } from "./makeStyles";
3+
4+
type MainImageProps = {
5+
backgroundImage: string;
6+
};
7+
8+
function MainImage(props: MainImageProps) {
9+
const { backgroundImage } = props;
10+
11+
const { classes, cx } = useStyles({
12+
backgroundImage,
13+
});
14+
return (
15+
<div id="mainImage" className={cx(classes.mainImage)}>
16+
<div>
17+
<figure>
18+
<div className={cx(classes.image)}></div>
19+
</figure>
20+
</div>
21+
<div className={cx(classes.mainCopy)}>
22+
<Typography variant="h1" className={cx(classes.text)}>
23+
秋葉原
24+
</Typography>
25+
</div>
26+
</div>
27+
);
28+
}
29+
30+
export default MainImage;
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { makeStyles } from "tss-react/mui";
2+
3+
export const useStyles = makeStyles<{ backgroundImage: string }>({
4+
name: "MainImage",
5+
})((theme, { backgroundImage }) => ({
6+
mainImage: {
7+
position: "fixed",
8+
top: "0",
9+
left: "0",
10+
width: "100%",
11+
"min-width": "1024px",
12+
height: "640px",
13+
overflow: "hidden",
14+
},
15+
image: {
16+
height: "640px",
17+
backgroundRepeat: "no-repeat",
18+
backgroundPosition: "center",
19+
backgroundSize: "cover",
20+
backgroundImage: `url(${backgroundImage})`,
21+
},
22+
text: {
23+
position: `relative`,
24+
transition: `top 1s ease, opacity 0.7s ease`,
25+
color: "#fff",
26+
fontSize: "60px",
27+
fontWeight: 400,
28+
letterSpacing: `0.05em`,
29+
lineHeight: `1.15`,
30+
textShadow: `0 0 8px #000, 0 0 12px #000`,
31+
textAlign: `center`,
32+
},
33+
mainCopy: {
34+
position: "absolute",
35+
top: "calc(50% + 60px)",
36+
left: "50%",
37+
width: "100%",
38+
transform: "translate(-50%, -50%)",
39+
},
40+
}));

src/themes/html5-reset.css

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
/*
2+
html5doctor.com Reset Stylesheet
3+
v1.6.1
4+
Last Updated: 2010-09-17
5+
Author: Richard Clark - http://richclarkdesign.com
6+
Twitter: @rich_clark
7+
*/
8+
9+
html,
10+
body,
11+
div,
12+
span,
13+
object,
14+
iframe,
15+
h1,
16+
h2,
17+
h3,
18+
h4,
19+
h5,
20+
h6,
21+
p,
22+
blockquote,
23+
pre,
24+
abbr,
25+
address,
26+
cite,
27+
code,
28+
del,
29+
dfn,
30+
em,
31+
img,
32+
ins,
33+
kbd,
34+
q,
35+
samp,
36+
small,
37+
strong,
38+
sub,
39+
sup,
40+
var,
41+
b,
42+
i,
43+
dl,
44+
dt,
45+
dd,
46+
ol,
47+
ul,
48+
li,
49+
fieldset,
50+
form,
51+
label,
52+
legend,
53+
table,
54+
caption,
55+
tbody,
56+
tfoot,
57+
thead,
58+
tr,
59+
th,
60+
td,
61+
article,
62+
aside,
63+
canvas,
64+
details,
65+
figcaption,
66+
figure,
67+
footer,
68+
header,
69+
hgroup,
70+
menu,
71+
nav,
72+
section,
73+
summary,
74+
time,
75+
mark,
76+
audio,
77+
video {
78+
margin: 0;
79+
padding: 0;
80+
border: 0;
81+
outline: 0;
82+
font-size: 100%;
83+
vertical-align: baseline;
84+
background: transparent;
85+
}
86+
87+
body {
88+
line-height: 1;
89+
}
90+
91+
article,
92+
aside,
93+
details,
94+
figcaption,
95+
figure,
96+
footer,
97+
header,
98+
hgroup,
99+
menu,
100+
nav,
101+
section {
102+
display: block;
103+
}
104+
105+
nav ul {
106+
list-style: none;
107+
}
108+
109+
blockquote,
110+
q {
111+
quotes: none;
112+
}
113+
114+
blockquote:before,
115+
blockquote:after,
116+
q:before,
117+
q:after {
118+
content: "";
119+
content: none;
120+
}
121+
122+
a {
123+
margin: 0;
124+
padding: 0;
125+
font-size: 100%;
126+
vertical-align: baseline;
127+
background: transparent;
128+
}
129+
130+
/* change colours to suit your needs */
131+
ins {
132+
background-color: #ff9;
133+
color: #000;
134+
text-decoration: none;
135+
}
136+
137+
/* change colours to suit your needs */
138+
mark {
139+
background-color: #ff9;
140+
color: #000;
141+
font-style: italic;
142+
font-weight: bold;
143+
}
144+
145+
del {
146+
text-decoration: line-through;
147+
}
148+
149+
abbr[title],
150+
dfn[title] {
151+
border-bottom: 1px dotted;
152+
cursor: help;
153+
}
154+
155+
table {
156+
border-collapse: collapse;
157+
border-spacing: 0;
158+
}
159+
160+
/* change border colour to suit your needs */
161+
hr {
162+
display: block;
163+
height: 1px;
164+
border: 0;
165+
border-top: 1px solid #cccccc;
166+
margin: 1em 0;
167+
padding: 0;
168+
}
169+
170+
input,
171+
select {
172+
vertical-align: middle;
173+
}

src/themes/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "./styles.css";
2+
import "./html5-reset.css";
23

34
export { darkTheme } from "./dark.theme";
45
export { lightTheme } from "./light.theme";

0 commit comments

Comments
 (0)