-
Notifications
You must be signed in to change notification settings - Fork 4
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 #153 from tahmid-saj/dev-calories-burned-styling
calories burned styling for signed in
- Loading branch information
Showing
23 changed files
with
481 additions
and
187 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...ponents/signed-in/calories-burned/activity-date-filter/activity-date-filter.component.jsx
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,80 @@ | ||
import Button from "../../../shared/button/button.component.jsx" | ||
import FormInput from "../../../shared/form-input/form-input.component.jsx" | ||
import "./activity-date-filter.styles.jsx" | ||
import { ActivityDateFilterContainer, FilterButtonsContainer } from "./activity-date-filter.styles.jsx" | ||
|
||
import { useState, useContext } from "react" | ||
import { CaloriesBurnedContext } from "../../../../contexts/signed-in/calories-burned/calories-burned.context.js" | ||
import { COLOR_CODES, COMMON_SPACING } from "../../../../utils/constants/shared.constants.js" | ||
import { Typography } from "@mui/material" | ||
import SimplePaper from "../../../shared/mui/paper/paper.component.jsx" | ||
|
||
const defaultFormFields = { | ||
activity: "", | ||
dateTracked: "", | ||
durationMinutes: "" | ||
} | ||
|
||
const paperStyles = { | ||
backgroundColor: COLOR_CODES.general["1"], | ||
width: COMMON_SPACING.filter.width | ||
} | ||
|
||
const ActivityDateFilter = () => { | ||
const [formFields, setFormFields] = useState(defaultFormFields) | ||
const { filterActivityDates, clearActivityDatesFilter } = useContext(CaloriesBurnedContext) | ||
|
||
const resetFormFields = () => { | ||
setFormFields(defaultFormFields) | ||
} | ||
|
||
const handleSubmit = (event) => { | ||
event.preventDefault() | ||
|
||
if (formFields.activity === "" && formFields.dateTracked === "" && | ||
!formFields.activity && !formFields.dateTracked && | ||
!formFields.durationMinutes && !formFields.durationMinutes) { | ||
console.log("please fill out all info") | ||
return | ||
} | ||
|
||
filterActivityDates(formFields) | ||
} | ||
|
||
const handleChange = (event) => { | ||
const { name, value } = event.target | ||
setFormFields({ ...formFields, [name]: value }) | ||
} | ||
|
||
const handleClearFilter = (event) => { | ||
event.preventDefault() | ||
|
||
resetFormFields() | ||
clearActivityDatesFilter() | ||
} | ||
|
||
return ( | ||
<ActivityDateFilterContainer> | ||
<SimplePaper styles={ paperStyles }> | ||
<form onSubmit={ handleSubmit }> | ||
<Typography variant="h6">Filter activities</Typography> | ||
<FormInput type="date" onChange={ handleChange } | ||
name="dateTracked" value={ formFields.dateTracked }></FormInput> | ||
|
||
<FormInput label="Activity" type="text" onChange={ handleChange } | ||
name="activity" value={ formFields.activity }></FormInput> | ||
|
||
<FormInput label="Duration (minutes)" type="text" onChange={ handleChange } | ||
name="durationMinutes" value={ formFields.durationMinutes }></FormInput> | ||
|
||
<FilterButtonsContainer> | ||
<Button type="submit">Filter</Button> | ||
<Button type="button" onClick={ handleClearFilter }>Clear</Button> | ||
</FilterButtonsContainer> | ||
</form> | ||
</SimplePaper> | ||
</ActivityDateFilterContainer> | ||
) | ||
} | ||
|
||
export default ActivityDateFilter |
14 changes: 14 additions & 0 deletions
14
...components/signed-in/calories-burned/activity-date-filter/activity-date-filter.styles.jsx
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,14 @@ | ||
import styled from "styled-components"; | ||
|
||
export const ActivityDateFilterContainer = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 2% 2% 1% 2%; | ||
` | ||
|
||
export const FilterButtonsContainer = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
` |
File renamed without changes.
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
10 changes: 10 additions & 0 deletions
10
...s/signed-in/calories-burned/add-activity/activity-date-form/activity-date-form.styles.jsx
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,10 @@ | ||
import styled from "styled-components"; | ||
|
||
export const ActivityDateFormContainer = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 0% 2% 0% 2%; | ||
padding: 2%; | ||
width: auto; | ||
` |
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
12 changes: 12 additions & 0 deletions
12
...signed-in/calories-burned/add-activity/activity-date-table/activity-date-table.styles.jsx
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,12 @@ | ||
import styled from "styled-components"; | ||
|
||
export const SearchedCaloriesBurnedActivitiesTableContainer = styled.div` | ||
display: block; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 2% 0% 2% 0%; | ||
` | ||
|
||
export const SearchedCaloriesBurnedActivitiesTable = styled.div` | ||
padding: 1%; | ||
` |
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
23 changes: 23 additions & 0 deletions
23
...ponents/signed-in/calories-burned/schedule/schedule-calendar/schedule-calendar.styles.jsx
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,23 @@ | ||
import styled from "styled-components"; | ||
import { COLOR_CODES } from "../../../../../utils/constants/shared.constants"; | ||
|
||
export const CalendarTodoList = styled.ul` | ||
text-align: left; | ||
padding: 0; | ||
list-style: none; | ||
li { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
` | ||
|
||
export const CaloriesBurnedCalendarContainer = styled.div` | ||
display: block; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 1%; | ||
margin: 1% 1% 0% 1%; | ||
background-color: ${COLOR_CODES.general["0"]}; | ||
` |
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
8 changes: 8 additions & 0 deletions
8
...ponents/signed-in/calories-burned/schedule/schedule-day-info/schedule-day-info.styles.jsx
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,8 @@ | ||
import styled from "styled-components"; | ||
|
||
export const CaloriesBurnedScheduleDayInfo = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 2% 2% 2% 2%; | ||
` |
Oops, something went wrong.