mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
HeroSection (presentational component)
This commit is contained in:
parent
96d44400f2
commit
33f7b58342
6 changed files with 121 additions and 2 deletions
37
src/components/HeroSection/HeroSection.css
Normal file
37
src/components/HeroSection/HeroSection.css
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
.section {
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 80px);
|
||||
background-image: url('http://placehold.it/700x300');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.titleWrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 2em;
|
||||
}
|
||||
.subTitle {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.ctaWrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
align-items: center;
|
||||
width: 90vw;
|
||||
}
|
||||
|
||||
32
src/components/HeroSection/HeroSection.js
Normal file
32
src/components/HeroSection/HeroSection.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import css from './HeroSection.css';
|
||||
|
||||
const HeroSection = props => (
|
||||
<section className={css.section}>
|
||||
<div className={css.content}>
|
||||
<div className={css.titleWrapper}>
|
||||
<div className={css.title}>
|
||||
<FormattedMessage id={'HeroSection.title'} defaultMessage={'Book Studiotime anywhere'} />
|
||||
</div>
|
||||
<div className={css.subTitle}>
|
||||
<FormattedMessage
|
||||
id={'HeroSection.subTitle'}
|
||||
defaultMessage={'The largest online community to rent music studios'}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={css.ctaWrapper}>
|
||||
{props.children}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
HeroSection.defaultProps = { children: [] };
|
||||
|
||||
const { any } = PropTypes;
|
||||
|
||||
HeroSection.propTypes = { children: any };
|
||||
|
||||
export default HeroSection;
|
||||
20
src/components/HeroSection/HeroSection.test.js
Normal file
20
src/components/HeroSection/HeroSection.test.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { TestProvider } from '../../util/test-helpers';
|
||||
import HeroSection from './HeroSection';
|
||||
|
||||
describe('HeroSection', () => {
|
||||
it('matches snapshot', () => {
|
||||
const component = renderer.create(
|
||||
(
|
||||
<TestProvider>
|
||||
<HeroSection params={{ displayName: 'most-awesome-shop' }}>
|
||||
test
|
||||
</HeroSection>
|
||||
</TestProvider>
|
||||
),
|
||||
);
|
||||
const tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
exports[`HeroSection matches snapshot 1`] = `
|
||||
<section
|
||||
className={undefined}>
|
||||
<div
|
||||
className={undefined}>
|
||||
<div
|
||||
className={undefined}>
|
||||
<div
|
||||
className={undefined}>
|
||||
<span>
|
||||
Book Studiotime anywhere
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className={undefined}>
|
||||
<span>
|
||||
The largest online community to rent music studios
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={undefined}>
|
||||
test
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
`;
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import HeroSection from './HeroSection/HeroSection';
|
||||
import NamedLink from './NamedLink/NamedLink';
|
||||
import PageLayout from './PageLayout/PageLayout';
|
||||
import RouterProvider from './RouterProvider/RouterProvider';
|
||||
import RoutesProvider from './RoutesProvider/RoutesProvider';
|
||||
|
||||
export { NamedLink, PageLayout, RouterProvider, RoutesProvider };
|
||||
export { HeroSection, NamedLink, PageLayout, RouterProvider, RoutesProvider };
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"landingpage.examplelink": "Show nice studios! (from json)"
|
||||
"landingpage.examplelink": "Show nice studios! (from json)",
|
||||
"HeroSection.title": "Book Studiotime anywhere",
|
||||
"HeroSection.subTitle": "The largest online community to rent music studios"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue