Skip to content

Commit

Permalink
検索ワードのラベルモジュール作成
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yoshiii committed Jul 10, 2022
1 parent dacd70b commit 8b56efa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/App.tsx
Expand Up @@ -5,6 +5,7 @@ import useGallerySet from "./hooks/useGallerySet";
import Button from "./component/Button";
import Gallery from "./component/Gallery";
import { color } from "./utils/color";
import Label from "./component/Label";
// import Setword from "./pages/Setwords";
// import Result from "./pages/Result";

Expand Down Expand Up @@ -104,7 +105,13 @@ function App() {
</SButtonWrap>
</SInputSection>
</form>
<p>{searchWords.join(",")}</p>
{searchWords.length !== 0 && (
<SLabelWrap>
{searchWords.map((word) => (
<Label>{word}</Label>
))}
</SLabelWrap>
)}
<Button variant="contained" type="button" onClick={handleDisplay}>
SHOW
</Button>
Expand Down Expand Up @@ -175,4 +182,10 @@ const SInputSection = styled.div`
margin-bottom: 40px;
border-bottom: 1px solid ${color.labelcolor};
`;
const SLabelWrap = styled.div`
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40px;
`;
export default App;
20 changes: 20 additions & 0 deletions src/component/Label.tsx
@@ -0,0 +1,20 @@
import React, { FC, ReactNode } from "react";
import { color } from "../utils/color";
import styled from "styled-components";
type Props = {
children: ReactNode;
};
const Label: FC<Props> = (props) => {
const { children } = props;
return <SLabel>{children}</SLabel>;
};
const SLabel = styled.div`
display: inline-block;
font-size: 16px;
line-height: 1.5;
font-weight: 400;
background: ${color.labelcolor};
padding: 3px 20px;
margin: 0 3px 6px;
`;
export default Label;

0 comments on commit 8b56efa

Please sign in to comment.