Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search component): cria a secao principal da aplicacao #6

Merged
merged 3 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 23 additions & 7 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
},
"homepage": "https://github.com/leottx/react-github-user-search#readme",
"dependencies": {
"nanoid": "^3.1.30"
"nanoid": "^3.1.30",
"polished": "^4.1.3"
},
"devDependencies": {
"@babel/core": "^7.16.5",
Expand Down
4 changes: 2 additions & 2 deletions src/assets/styles/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const HeaderContainer = styled.header`
font-weight: 700;
`;
export const LogoLink = styled.a`
font-size: 3rem;
font-size: 2.4rem;
cursor: pointer;
transition-property: color;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
Expand All @@ -20,7 +20,7 @@ export const LogoLink = styled.a`
export const ThemeButton = styled.button`
text-transform: uppercase;
letter-spacing: 0.3em;
font-size: 1.6rem;
font-size: 1.4rem;
display: flex;
align-items: center;
gap: 1rem;
Expand Down
54 changes: 54 additions & 0 deletions src/assets/styles/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import styled from 'styled-components';
import { darken } from 'polished';

export const Main = styled.main``;

export const SearchContainer = styled.header`
margin-bottom: 2.4rem;
background: var(--white);
border-radius: 1.5rem;
padding: 1rem;
`;

export const SearchForm = styled.form`
display: flex;
font-size: 1.4rem;
gap: 1rem;
justify-content: space-between;
`;

export const SearchField = styled.input.attrs({ type: 'text' })`
color: var(--txt-1);
min-width: 0;
border: transparent;
outline: none;
width: 100%;
&::placeholder {
color: var(--txt-2);
}
`;

export const SearchButton = styled.button`
background: var(--txt-5);
border-radius: 1rem;
padding: 0.8em 1em;
color: var(--white);
font-weight: 700;
margin-left: auto;
transition-property: 'background';
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
&:hover {
background: ${({ theme: { c } }) => darken(0.1, c.bgBtn)};
}
`;

export const Wrapper = styled.div`
gap: 1rem;
align-items: center;
display: flex;
flex-grow: 2;
svg {
color: var(--txt-5);
}
`;
8 changes: 8 additions & 0 deletions src/assets/styles/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const theme = {
// CORES
c: {
bgBtn: '#266CFF',
},
};

export default theme;
2 changes: 2 additions & 0 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Helmet } from 'react-helmet';
// COMPONENTS
import { Container } from '@Styles/global';
import GitHeader from '@Components/GitHeader';
import GitMain from '@Components/GitMain';

// IMAGES
import favicon from '@Images/favicon.svg';
Expand All @@ -20,6 +21,7 @@ const App = () => {
</Helmet>
<Container>
<GitHeader />
<GitMain />
</Container>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/GitHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const GitHeader = () => {
<LogoLink>devfinder</LogoLink>
<ThemeButton>
Light
<MdWbSunny size={24} />
<MdWbSunny size={22} />
</ThemeButton>
</HeaderContainer>
);
Expand Down
14 changes: 14 additions & 0 deletions src/components/GitMain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { Main } from '@Styles/main';

import GitSearch from '@Components/GitSearch';

const GitMain = () => {
return (
<Main>
<GitSearch></GitSearch>
</Main>
);
};

export default GitMain;
35 changes: 35 additions & 0 deletions src/components/GitSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { ThemeProvider } from 'styled-components';

// TEMA
import theme from '@Styles/theme';

// ICONES
import { RiSearchLine } from 'react-icons/ri';

// COMPONENTES
import {
SearchContainer,
SearchForm,
SearchField,
SearchButton,
Wrapper,
} from '@Styles/main';

const GitSearch = () => {
return (
<SearchContainer>
<SearchForm>
<Wrapper>
<RiSearchLine size={30} />
<SearchField placeholder='Github username' />
</Wrapper>
<ThemeProvider theme={theme}>
<SearchButton>Search</SearchButton>
</ThemeProvider>
</SearchForm>
</SearchContainer>
);
};

export default GitSearch;