-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from osohyun0224/master
- Loading branch information
Showing
13 changed files
with
356 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { Link } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const CourseCardContainer = styled.div` | ||
width: 360px; | ||
height: 310px; | ||
`; | ||
|
||
|
||
const CourseImage = styled.div` | ||
height: 240px; | ||
width: 360px; | ||
background-image: url(${props => props.image}); | ||
background-size: cover; | ||
position: relative; | ||
margin-bottom: 10px; | ||
`; | ||
|
||
|
||
const TimeInfo = styled.div` | ||
width: 57px; | ||
height: 23px; | ||
background-color: rgba(14, 13, 13, 0.8); | ||
border-radius: 4px; | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
const TimeText = styled.span` | ||
color: #F2F2F2; | ||
font-size: 12px; | ||
`; | ||
|
||
const CourseTitle = styled.span` | ||
font-size: 20px; | ||
color: #F2F2F2; | ||
`; | ||
|
||
const TagButton = styled.span` | ||
margin-top: 10px; | ||
height: 28px; | ||
padding: 0 10px; | ||
background-color: #242424; | ||
border-radius: 50px; | ||
border: 1px solid #444444; | ||
font-size: 16px; | ||
color: #F2F2F2; | ||
margin-right: 5px; | ||
display: inline-flex; | ||
align-items: center; | ||
`; | ||
|
||
const Hash = styled.span` | ||
color: #727272; | ||
`; | ||
|
||
const ExerciseCard = ({ id, image, title, tags }) => { | ||
return ( | ||
<Link to={`/program/${id}`} style={{ textDecoration: 'none', color: 'inherit' }}> | ||
<CourseCardContainer> | ||
<CourseImage image={image}> | ||
<TimeInfo> | ||
<TimeText>00:00</TimeText> | ||
</TimeInfo> | ||
</CourseImage> | ||
|
||
<CourseTitle>{title}</CourseTitle> | ||
<div> | ||
{tags && tags.map((tag, index) => ( | ||
<TagButton key={index}> | ||
<Hash>#</Hash> | ||
{tag} | ||
</TagButton> | ||
))} | ||
</div> | ||
</CourseCardContainer> | ||
</Link> | ||
); | ||
}; | ||
|
||
ExerciseCard.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
image: PropTypes.string, | ||
title: PropTypes.string.isRequired, | ||
tags: PropTypes.arrayOf(PropTypes.string) | ||
}; | ||
|
||
export default ExerciseCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useState, useEffect } from "react"; | ||
import { getAllCourses } from "../librarys/exercise-api"; | ||
import ExerciseCard from "../components/ExerciseCard"; | ||
import styled from "styled-components"; | ||
|
||
const Container = styled.div` | ||
width: 1200px; | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 20px; | ||
margin-top: 20px; | ||
margin-left:10px; | ||
`; | ||
|
||
function ExerciseList() { | ||
const [courses, setCourses] = useState([]); | ||
|
||
useEffect(() => { | ||
async function fetchCourses() { | ||
const data = await getAllCourses(); | ||
setCourses(data); | ||
} | ||
|
||
fetchCourses(); | ||
}, []); | ||
|
||
return ( | ||
<Container> | ||
{courses.map((course) => ( | ||
<ExerciseCard key={course.id} {...course} /> | ||
))} | ||
</Container> | ||
); | ||
} | ||
|
||
export default ExerciseList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { useState } from "react"; | ||
import styled from "styled-components"; | ||
|
||
const FilterSection = styled.div` | ||
display: flex; | ||
align-items: center; | ||
margin-right: 10px; | ||
margin-top: 20px; | ||
`; | ||
|
||
const Title = styled.span` | ||
font-size: 20px; | ||
font-weight: bold; | ||
color: #5f5f5f; | ||
width: 120px; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
margin-right: 10px; | ||
`; | ||
|
||
const Divider = styled.div` | ||
width: 2px; | ||
height: 20px; | ||
background-color: #5f5f5f; | ||
margin-right: 10px; | ||
`; | ||
|
||
const Button = styled.button` | ||
width: 100px; | ||
height: 36px; | ||
background-color: ${(props) => (props.selected ? "#6968CC" : "#1E1E1E")}; | ||
color: #f2f2f2; | ||
border-radius: 10px; | ||
font-size: 16px; | ||
border: none; | ||
margin-right: 5px; | ||
&:focus { | ||
outline: none; | ||
} | ||
`; | ||
|
||
const FilterButtons = () => { | ||
const [selectedCategory, setSelectedCategory] = useState("전체"); | ||
const [selectedPose, setSelectedPose] = useState("전체"); | ||
|
||
return ( | ||
<div> | ||
<FilterSection> | ||
<Title>카테고리</Title> | ||
<Divider /> | ||
{["전체", "팔", "어깨", "무릎", "허벅지"].map((category) => ( | ||
<Button | ||
key={category} | ||
selected={selectedCategory === category} | ||
onClick={() => { | ||
setSelectedCategory((current) => | ||
current === category ? "전체" : category, | ||
); | ||
}} | ||
> | ||
{category} | ||
</Button> | ||
))} | ||
</FilterSection> | ||
|
||
<FilterSection> | ||
<Title>자세</Title> | ||
<Divider /> | ||
{["전체", "선 자세", "앉은 자세", "누운 자세"].map((pose) => ( | ||
<Button | ||
key={pose} | ||
selected={selectedPose === pose} | ||
onClick={() => { | ||
setSelectedPose((current) => (current === pose ? "전체" : pose)); | ||
}} | ||
> | ||
{pose} | ||
</Button> | ||
))} | ||
</FilterSection> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FilterButtons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.