Skip to content

Commit

Permalink
bugfix some features in styles
Browse files Browse the repository at this point in the history
  • Loading branch information
TaurusVB committed Sep 21, 2023
1 parent 7e0d110 commit 4b122a4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const DayDiaryProductsOrExercises = ({
list,
productTable,
exerciseTable,
windowWidth,
}) => {
return (
<DayDiaryContainer marginBottom={marginBottom}>
Expand All @@ -35,20 +34,16 @@ const DayDiaryProductsOrExercises = ({
</DayDiarySubDiv>
{list.length !== 0 ? (
<>
{windowWidth >= 768 && (
<TableForDiary
list={list}
productTable={productTable}
exerciseTable={exerciseTable}
/>
)}
{windowWidth < 768 && (
<TableForDiaryOnMobile
list={list}
productTable={productTable}
exerciseTable={exerciseTable}
/>
)}
<TableForDiary
list={list}
productTable={productTable}
exerciseTable={exerciseTable}
/>
<TableForDiaryOnMobile
list={list}
productTable={productTable}
exerciseTable={exerciseTable}
/>
</>
) : (
<DayNoContentText>
Expand All @@ -65,7 +60,6 @@ DayDiaryProductsOrExercises.propTypes = {
list: PropTypes.array,
productTable: PropTypes.bool,
exerciseTable: PropTypes.bool,
windowWidth: PropTypes.number,
};

export default DayDiaryProductsOrExercises;
9 changes: 5 additions & 4 deletions src/components/TableForDiary/TableForDiary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
HeaderCont,
ColumnNameProducts,
ColumnNameExercises,
CustomContainer,
} from './TableForDiary.styled';
import {
Table,
Expand All @@ -28,7 +29,7 @@ const TableForDiary = ({ list, productTable, exerciseTable }) => {
return (
<>
{productTable && (
<>
<CustomContainer>
<HeaderCont>
<ColumnNameProducts>Title</ColumnNameProducts>
<ColumnNameProducts>Category</ColumnNameProducts>
Expand Down Expand Up @@ -71,11 +72,11 @@ const TableForDiary = ({ list, productTable, exerciseTable }) => {
</>
)}
</Table>
</>
</CustomContainer>
)}

{exerciseTable && (
<>
<CustomContainer>
<HeaderCont>
<ColumnNameExercises>Body Part</ColumnNameExercises>
<ColumnNameExercises>Equipment</ColumnNameExercises>
Expand Down Expand Up @@ -126,7 +127,7 @@ const TableForDiary = ({ list, productTable, exerciseTable }) => {
</>
)}
</Table>
</>
</CustomContainer>
)}
</>
);
Expand Down
7 changes: 7 additions & 0 deletions src/components/TableForDiary/TableForDiary.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import styled from '@emotion/styled';

import { colors, mq } from '../../utils';

export const CustomContainer = styled.div`
display: none;
${mq.tablet} {
display: block;
}`

export const DeleteBtn = styled.button`
padding: 0;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const CustomContainer = styled.div`
overflow: auto;
margin-top: 22px;
height: 254px;
${mq.tablet} {
display: none;
}
`;

export const ContainerForTable = styled.div`
Expand Down Expand Up @@ -59,18 +63,14 @@ export const BottomContainer = styled.div`
& > div {
&:nth-of-type(4) {
& > p {
padding: 0;
margin-top: 35px;
border: none;
}
}
}
}
`;

export const Cell = styled.div`
Expand Down
16 changes: 0 additions & 16 deletions src/pages/Diary/Diary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,6 @@ const listExercises = [
];

const Diary = () => {
const [windowWidth, setWindowWidth] = useState(window.innerWidth);

useEffect(() => {
window.addEventListener('resize', updateWindowWidth);

return () => {
window.removeEventListener('resize', updateWindowWidth);
};
}, []);

const updateWindowWidth = () => {
setWindowWidth(window.innerWidth);
};

return (
<>
<Title text={'Diary'} margin={mgForTitle} />
Expand All @@ -167,14 +153,12 @@ const Diary = () => {
marginBottom={40}
list={listProducts}
productTable
windowWidth={windowWidth}
to={'/products'}
/>

<DayDiaryProductsOrExercises
list={listExercises}
exerciseTable
windowWidth={windowWidth}
to={'/exercises'}
/>
</CustomDivForTables>{' '}
Expand Down

0 comments on commit 4b122a4

Please sign in to comment.