Skip to content

Commit

Permalink
Demo/open mic (#4)
Browse files Browse the repository at this point in the history
* remove project reference

* add Hero component and theme from css

* Fixed test

Co-authored-by: Roberto Molina <[email protected]>
  • Loading branch information
ulises-jeremias and rpmolina authored Jul 14, 2022
1 parent e323760 commit d4313ed
Show file tree
Hide file tree
Showing 30 changed files with 504 additions and 22 deletions.
3 changes: 1 addition & 2 deletions config/common-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ module.exports = {
locales: path.resolve(__dirname, '..', 'static/locales/'),
images: path.resolve(__dirname, '..', 'static/images/'),
template: path.resolve(__dirname, '..', 'public/index.html'),
// favicon: path.resolve(__dirname, '..', 'public/favicon.ico'),
favicon: path.resolve(__dirname, '..', 'public/amalgam-32x32.png'),
favicon: path.resolve(__dirname, '..', 'public/favicon.ico'),
manifest: path.resolve(__dirname, '..', 'public/manifest.json'),
serviceWorker: path.resolve(__dirname, '..', 'src/', 'service-worker.ts'),
};
Binary file removed public/amalgam-32x32.png
Binary file not shown.
Binary file modified public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import 'theme';
import Loading from 'components/Loading';
import AppRoutes from 'routes/AppRoutes';
import ReactQueryProvider from 'providers/ReactQueryProvider';
import { toggleTheme } from 'utils/utils';

window.toggleTheme = toggleTheme;

const App: FC = () => (
<Suspense fallback={<Loading />}>
Expand Down
49 changes: 49 additions & 0 deletions src/components/Animations/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import styled, { keyframes, css } from 'styled-components';

export const spin = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;

export const upDown = keyframes`
from {
transform: translate3d(0,25px,0);
}
to {
transform: translate3d(0,-50px,0);
}
`;

export const upDownWide = keyframes`
from {
transform: translate3d(0,0,0);
}
to {
transform: translate3d(0,-150px,0);
}
`;

export const upDownAnimation = css`
animation: ${upDown} 7s ease-in-out infinite alternate;
`;

export const upDownWideAnimation = css`
animation: ${upDownWide} 15s ease-in-out infinite alternate;
`;

export const UpDown = styled.div`
${upDownAnimation};
position: relative;
${(props) => props}
`;

export const UpDownWide = styled.div`
${upDownWideAnimation};
position: relative;
${(props) => props}
`;
13 changes: 13 additions & 0 deletions src/components/CircleShape/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from 'styled-components';

export const CircleShape = styled.div`
position: relative;
background-image: linear-gradient(${(props) => `${props.deg}, ${props.primary}, ${props.secondary}`});
border-radius: 9999px;
z-index: 1;
height: 100px;
width: 100px;
${(props) => props};
`;

export default CircleShape;
2 changes: 1 addition & 1 deletion src/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import Header from './Header';

test('testing i18n in Header', async () => {
render(<Header />);
expect(screen.getByText('How it Works')).toBeTruthy();
expect(screen.getByText('Router example')).toBeTruthy();
});
11 changes: 6 additions & 5 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@ import { Link, NavLink } from 'react-router-dom';
import { Routes } from 'routes/Routes';
import Button from 'components/Button';
import Sparkles from 'components/Sparkles';
import logo from 'app-assets/images/logo.png';
import NanBrand from 'components/NanBrand';

const Header: FC = () => {
const { t } = useTranslation(['config', 'translations']);
const isFixed = useScroll(50);

return (
<FixedContainer>
<Nav condensed={isFixed}>
<NavContainer>
<Link to={Routes.ROOT}>
<Brand src={logo} alt={t('app.title', { ns: 'config' })} />
<Brand>
<NanBrand />
</Brand>
</Link>

<NavList>
<NavItem>
<NavLink to={Routes.LINKS_EXAMPLES}>{t('header.howItWorks', { ns: 'translations' })}</NavLink>
<NavLink to={Routes.LINKS_EXAMPLES}>{t('header.routerLinkExample', { ns: 'translations' })}</NavLink>
</NavItem>
<NavItem>
<NavLink to={Routes.API_EXAMPLES}>{t('header.integrations', { ns: 'translations' })}</NavLink>
</NavItem>
<NavItem>{t('header.pricing', { ns: 'translations' })}</NavItem>
<NavItem>{t('header.aboutUs', { ns: 'translations' })}</NavItem>
</NavList>

<Sparkles colors={['#FFC700', '#22d0b6', '#22d0b6', '#80a6e9', '#f280b9', '#e35da0', '#0cea86']}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Nav = styled.nav<NavProps>`
color: black;
background-color: #fefefe;
transition: all 0.2s ease-in-out 0s;
padding: ${({ condensed }) => (condensed ? '20px 0' : '60px 20px')};
padding: ${({ condensed }) => (condensed ? '20px 0' : '40px 20px')};
box-shadow: ${({ condensed }) => (condensed ? '0 2px 10px 0 rgba(36, 50, 66, 0.075)' : 'none')};
`;

Expand All @@ -34,7 +34,7 @@ export const NavContainer = styled.div`
padding: 0 20px;
`;

export const Brand = styled.img`
export const Brand = styled.div`
padding-right: 20px;
`;

Expand Down
49 changes: 49 additions & 0 deletions src/components/Hero/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import logo from 'app-assets/images/react.svg';
import NanLabsIcon from 'components/NanLabsIcon';
import ShapeBackground from 'components/ShapeBackground';
import useWindowSize from 'hooks/useWindowSize';

import {
Root,
HeroContainer,
TextContainer,
Title,
Subtitle,
IllustrationContainer,
Image,
ImageContainer,
} from './styles.js';

const Hero = () => {
const windowSize = useWindowSize();
const showIllustration = windowSize.width > 1200;

console.log('showIllustration', showIllustration);

return (
<Root>
<HeroContainer>
<TextContainer fullWidth={!showIllustration}>
<Title>Agregar un titulo</Title>
<Subtitle>Agregar un subtitulo</Subtitle>
</TextContainer>
{showIllustration && (
<IllustrationContainer>
<Image src={logo} position="absolute" alt="logo" top="-12vw" right="-5vw" height="21vw" />
<ImageContainer top="1vw" right="10vw">
<NanLabsIcon
fill={'#5d73f5'}
width="17vw"
height="17vw"
filter={'drop-shadow( 3px 3px 2px rgba(0, 0, 0, .4))'}
/>
</ImageContainer>
</IllustrationContainer>
)}
<ShapeBackground />
</HeroContainer>
</Root>
);
};
export default Hero;
80 changes: 80 additions & 0 deletions src/components/Hero/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import styled from 'styled-components';

export const Root = styled.div`
display: flex;
flex: 1;
align-items: center;
justify-content: center;
width: 100%;
overflow: hidden;
background-color: var(--background-color);
`;

export const HeroContainer = styled.div`
display: flex;
flex: 1;
flex-direction: row;
align-items: stretch;
justify-content: flex-start;
height: 100%;
max-width: 1500px;
min-height: 250px;
margin: 60px 100px;
position: relative;
@media (max-width: var(--breakpoint-mobile)px) {
margin: 60px 30px;
}
`;

export const TextContainer = styled.div`
display: flex;
width: ${(props) => (props.fullWidth ? '100%' : '50%')};
flex-direction: column;
z-index: 100;
`;

export const Title = styled.h1`
color: var(--text-color-primary);
font-size: 48px;
font-weight: 700;
text-align: left;
line-height: 1.25;
margin: 4px 0;
@media (max-width: var(--breakpoint-mobile)px) {
font-size: 26px;
}
`;

export const Subtitle = styled.h2`
color: var(--text-color-secondary);
font-size: 20px;
font-weight: 400;
text-align: left;
line-height: 1.65;
margin: 10px 0;
@media (max-width: var(--breakpoint-mobile)px) {
font-size: 18px;
}
`;

export const IllustrationContainer = styled.div`
display: block;
width: 100%;
height: 100%;
position: absolute;
`;

export const Image = styled.img`
position: absolute;
z-index: 10;
${(props) => props};
`;

export const ImageContainer = styled.div`
position: absolute;
z-index: 10;
${(props) => props};
`;
50 changes: 50 additions & 0 deletions src/components/NanBrand/NanBrand.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/components/NanBrand/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './NanBrand.js';
11 changes: 11 additions & 0 deletions src/components/NanLabsIcon/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

const NanLabsIcon = (props) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 108 108" {...props}>
<path d="m54 0c-29.8 0-54 24.2-54 54s24.2 54 54 54 54-24.2 54-54-24.2-54-54-54zm16.2 14v60.8l-30.3-61.6c4.4-1.5 9.1-2.4 14.1-2.4 5.7 0 11.2 1.1 16.2 3.2zm-59.4 40c0-13.6 6.3-25.8 16.2-33.7v67.4c-9.9-7.9-16.2-20.1-16.2-33.7zm26.9 40v-60.8l30.3 61.6c-4.4 1.5-9.1 2.4-14.1 2.4-5.7 0-11.2-1.1-16.2-3.2zm43.3-6.3v-67.4c9.9 7.9 16.2 20.1 16.2 33.7s-6.4 25.8-16.2 33.7z"></path>
</svg>
);
};

export default NanLabsIcon;
17 changes: 17 additions & 0 deletions src/components/RingShape/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styled from 'styled-components';

export const RingShape = styled.div`
position: relative;
background-color: transparent;
z-index: 1;
border-width: 20px;
border-style: solid;
border-radius: 9999px;
height: ${(props) => props.size || '100px'};
width: ${(props) => props.size || '100px'};
border-color: ${(props) => props.color || 'teal'};
border-width: ${(props) => props.ring || '20px'};
${(props) => props};
`;

export default RingShape;
Loading

0 comments on commit d4313ed

Please sign in to comment.