React
by Abdul Ahmad
HTML
<div id="app"></div>
SCSS
$blue: #0059ff;
$green: #00d99b;
$text-color: #1e1f21;
$text-color-light1: lighten($text-color, 10%);
$text-color-light2: lighten($text-color, 20%);
html, body {
background: #20262E;
padding: 0;
font-family: Helvetica;
height: 100%;
font-size: 14px;
color: $text-color;
}
#app {
background: #fff;
height: 100%;
}
.title-primary {
font-size: 32px;
line-height: 40px;
}
.page-title {
@extend .title-primary;
}
.section-title {
@extend .title-primary;
}
.subtitle-primary {
font-size: 16px;
line-height: 22px;
// font-weight: 100;
color: $text-color-light1;
margin-top: 20px;
}
.page-subtitle {
@extend .subtitle-primary;
}
.color-blue {
color: $blue;
}
.color-green {
color: $green;
}
.page-section {
padding: 100px 0;
// border: 1px dashed #ddd;
position: relative;
z-index: 1;
}
.page-width {
margin: 0 auto;
max-width: 800px;
padding: 0 20px;
// border: 1px dashed #ddd;
}
.nav-sections-wrap {
display: flex;
justify-content: space-between;
}
.nav-sections-wrap-std {
padding: 10px 0;
}
.nav-item-list {
display: flex;
}
.nav-item {
display: flex;
align-items: center;
justify-content: center;
// font-weight: bold;
position: relative;
transition: color 0.2s;
color: $text-color-light2;
padding: 10px 0;
&:hover {
cursor: pointer;
color: $blue;
transition: color 0.2s;
}
.indicator {
display: none;
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background: $blue;
}
}
.nav-item-active {
color: $blue;
.indicator {
display: block;
}
}
.nav-item-no-hover-effect {
&:hover {
color: inherit;
}
}
.nav-section-left {
.nav-item {
margin-right: 20px;
&:first-child {
margin-right: 0;
}
}
}
.nav-section-right {
.nav-item {
margin-left: 20px;
&:first-child {
margin-left: 0;
}
}
}
.page-section--hero {
background: linear-gradient(white, #fbfcfd);
...
React
function PageWidth({ children }) {
return (
<div className='page-width'>
{ children }
</div>
);
}
function PageSection({ children, customClass = '' }) {
return (
<section className={`page-section ${customClass}`}>
{ children }
</section>
);
}
function Nav({ children }) {
return (
<section className='nav nav-main'>
<PageWidth>
{ children }
</PageWidth>
</section>
);
}
function NavSectionsWrapStd({ children }) {
return (
<nav className='nav-sections-wrap nav-sections-wrap-std'>
{ children }
</nav>
);
}
function NavSection({ children, position }) {
const classNamePosition = `nav-section-${position}`;;
return (
<section className={`nav-section ${classNamePosition}`}>
<ul className='nav-item-list'>
{ children }
</ul>
</section>
);
}
function NavItem({ children, active, noHoverEffect }) {
const activeClass = active ? 'nav-item-active' : '';
const noHoverEffectClass = noHoverEffect ? 'nav-item-no-hover-effect' : '';
return (
<li className={`nav-item ${activeClass} ${noHoverEffectClass}`}>
{ children }
<div className='indicator' />
</li>
);
}
function SectionTitle({ children }) {
return (
<h3 className='section-title'>
{ children }
</h3>
);
}
function PageTitle({ children }) {
return (
<h1 className='page-title'>
{ children }
</h1>
);
}
function PageSubtitle({ children }) {
return (
<h2 className='page-subtitle'>
{ children }
</h2>
);
}
function LinkWithArrow({ children }) {
return (
<div className='link-with-arrow'>
<div className='content'>
<span className='text'>{ children }</span>
<span className='arrow'>
<span className='arrow-icon'>{'>'}</span>
</span>
</div>
</div>
);
}
function Button({ children }) {
return (
<div className='button'>
{ children }
</div>
);
}
function App() {
return (
<div>
<Nav>
...