Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[디자인/리팩토링] styled-componets 이름 및 구조 변경 #28

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

Merged
merged 8 commits into from
Jun 24, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"g": "^2.0.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-redux": "^7.2.6",
"react-scripts": "5.0.1",
"redux": "^4.1.2",
"recoil": "^0.7.3",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4"
Expand Down
29 changes: 9 additions & 20 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,19 @@ import SearchResult from './SearchResult/SearchResult';
import Footer from './Footer/footer';
import Loading from './Loading';

import styled, { ThemeProvider } from 'styled-components';
import { ThemeProvider } from 'styled-components';
import { theme } from './theme';
import { GlobalStyle } from './GlobalStyle';

const AppDiv = styled.div`
display: flex;
width: 1170px;
margin: 0 auto;
justify-content: center;
`;

export default function App() {
return (
<>
<ThemeProvider theme={theme}>
<GlobalStyle />
<h1>🔍 프로그래머스 해설 은행</h1>
<AppDiv className="app">
<Loading />
<SearchBox />
<SearchResult />
<Footer />
</AppDiv>
</ThemeProvider>
</>
<ThemeProvider theme={theme}>
<GlobalStyle />
<h1>🔍 프로그래머스 해설 은행</h1>
<Loading />
<SearchBox />
<SearchResult />
<Footer />
</ThemeProvider>
);
}
3 changes: 2 additions & 1 deletion src/Footer/components/CopyRight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FooterDiv, FooterInAnchor } from '../footer';
import { repoLink } from '../footer';

export default function CopyRight({ repoLink }) {
export default function CopyRight() {
return (
<>
<FooterDiv>
Expand Down
3 changes: 2 additions & 1 deletion src/Footer/components/Issuse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FooterDiv, FooterTitle, FooterInAnchor } from '../footer';
import { repoLink } from '../footer';

export default function Issues({ repoLink }) {
export default function Issues() {
return (
<FooterDiv className="Issues">
<FooterTitle className="IssuesTitle footerTitle" title="이슈제보">
Expand Down
3 changes: 2 additions & 1 deletion src/Footer/components/LogoBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gitHubLogoPath from '../../images/github.png';
import programmersLogoPath from '../../images/programmers.png';
import styled from 'styled-components';
import { repoLink } from '../footer';

const LogoBoxDiv = styled.div`
position: absolute;
Expand Down Expand Up @@ -28,7 +29,7 @@ const FooterLogo = styled.img`
cursor: pointer;
`;

export default function LogoBox({ repoLink }) {
export default function LogoBox() {
return (
<LogoBoxDiv className="logoBox">
<a href={repoLink} target="_blank">
Expand Down
3 changes: 2 additions & 1 deletion src/Footer/components/Repo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FooterDiv, FooterTitle, FooterInAnchor } from '../footer';
import { repoLink } from '../footer';

export default function Repo({ repoLink }) {
export default function Repo() {
return (
<FooterDiv className="repo">
<FooterTitle className="repoTitle footerTitle" title="깃허브 레포지토리">
Expand Down
12 changes: 6 additions & 6 deletions src/Footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ export const repoLink =

export default function Footer() {
return (
<FooterBox id="footerBox">
<div className="footer">
<Repo repoLink={repoLink} />
<Issues repoLink={repoLink} />
<FooterBox>
<div>
<Repo />
<Issues />
<Contributor />
<CopyRight repoLink={repoLink} />
<CopyRight />
</div>
<LogoBox repoLink={repoLink} />
<LogoBox />
</FooterBox>
);
}
5 changes: 5 additions & 0 deletions src/GlobalStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ export const GlobalStyle = createGlobalStyle`
border-bottom: 4px solid ${props => props.theme.borderLevelTitle};
}

#root {
width:100%;
margin: 0 auto;
justify-content: center;
}
`;
16 changes: 9 additions & 7 deletions src/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRecoilValue } from 'recoil';
import { loadingState } from './index.js';
import styled from 'styled-components';

const LoadingDiv = styled.div`
const Wrapper = styled.div`
display: flex;
position: absolute;
top: -50px;
Expand All @@ -12,13 +12,15 @@ const LoadingDiv = styled.div`
align-items: center;
color: #0aa1dd;
font-size: 18px;
min-width: 2500px;
min-width: 1500px;
width: 100%;
min-height: 2000px;
height: 100%;
z-index: 5;
background-color: ${props => props.theme.background};
`;

const LoadingChild = styled.div`
const Content = styled.div`
position: relative;
top: 400px;
align-items: center;
Expand All @@ -29,11 +31,11 @@ const LoadingChild = styled.div`
export default function Loading() {
const loading = useRecoilValue(loadingState);
return loading ? (
<LoadingDiv className="loading">
<LoadingChild>
<Wrapper>
<Content>
<img src={spinnerPath} alt="Loading..." />
Loading…
</LoadingChild>
</LoadingDiv>
</Content>
</Wrapper>
) : null;
}
13 changes: 11 additions & 2 deletions src/SearchBox/SearchBox.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import SearchInput from './components/SearchInput';
import SearchableList from './components/SearchableList';
import SearchPhrases from './components/SearchPhrases';
import styled from 'styled-components';

const Wrapper = styled.div`
margin-left: -600px;
width: 320px;
display: inline-block;
position: absolute;
left: 50%;
`;

export default function SearchBox() {
return (
<div className="searchBox">
<Wrapper>
<SearchInput />
<SearchableList />
<SearchPhrases />
</div>
</Wrapper>
);
}
16 changes: 7 additions & 9 deletions src/SearchBox/components/SearchInput.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CreateFuzzyMatcher } from '../utils/koreanFuzzy';
import styled from 'styled-components';

const SearchInputDiv = styled.input`
const Input = styled.input`
width: 320px;
height: 50px;
background-color: ${props => props.theme.background};
Expand Down Expand Up @@ -29,13 +29,11 @@ export default function SearchInput() {
}

return (
<div className="searchInput">
<SearchInputDiv
type="search"
id="searchInput"
placeholder="문제 이름을 검색하세요."
onChange={search}
/>
</div>
<Input
type="search"
id="searchInput"
placeholder="문제 이름을 검색하세요."
onChange={search}
/>
);
}
10 changes: 5 additions & 5 deletions src/SearchBox/components/SearchPhrases.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styled from 'styled-components';

const SearchPhrasesDiv = styled.div`
const Wrapper = styled.div`
width: 320px;
text-align: center;
font-size: 20px;
font-weight: 600;
font-family: 'Noto Sans KR', sans-serif;
color: #3c6382;
color: ${props => props.theme.phrasesColor};
margin: 20px 0;
`;

Expand All @@ -17,12 +17,12 @@ const Anchor = styled.div`

export default function SearchPhrases() {
return (
<SearchPhrasesDiv className="searchPhrases">
<Anchor href="#footerBox">
<Wrapper>
<Anchor>
찾는 문제가 없으신가요?
<br />
Repository에 풀이를 제보해주세요
</Anchor>
</SearchPhrasesDiv>
</Wrapper>
);
}
24 changes: 20 additions & 4 deletions src/SearchBox/components/SearchableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { useRecoilValue, useSetRecoilState } from 'recoil';
import { solutionState, loadingState, solutionNoState } from '../../index.js';
import styled from 'styled-components';

const SearchableListDiv = styled.div`
const Wrapper = styled.div`
width: 320px;
display: inline;
`;

const FileListContainer = styled.div`
Expand Down Expand Up @@ -59,6 +60,22 @@ const FileListContainer = styled.div`
}
`;

// const FileList = styled.div`
// background-color: ${props => props.theme.bgColor};
// position: relative;
// top: 0;
// padding: 10px;
// margin: 0;
// border-bottom: 1px solid ${props => props.theme.bgBtn2};
// outline: none;
// color: $text-color;
// font-size: 18px;
// font-weight: 700;
// &:last-child {
// border: none;
// }
// `;

export default function SearchableList() {
let [fileListHTML, changeState] = useState('');
const setSolutionInfo = useSetRecoilState(solutionState);
Expand Down Expand Up @@ -107,13 +124,12 @@ export default function SearchableList() {
}

return (
<SearchableListDiv className="searchableList">
<Wrapper>
<FileListContainer
className="file-list-container"
onClick={showResult}
solutionNoState={0}
dangerouslySetInnerHTML={{ __html: fileListHTML }}
></FileListContainer>
</SearchableListDiv>
</Wrapper>
);
}
Loading