updated card expand styles

This commit is contained in:
maciekglowacki 2020-11-01 21:41:16 +01:00
parent ab9f99df1f
commit 4276d20319
2 changed files with 35 additions and 40 deletions

View File

@ -7,10 +7,6 @@ import styled from 'styled-components';
import { makeStyles } from '@material-ui/core/styles';
import { ReactComponent as CloseIcon } from '../assets/close.svg';
interface ClassExandIconProps {
isSelected: boolean;
}
const CourseStyled = styled.div`
display: flex;
min-height: 40px;
@ -20,7 +16,6 @@ const CourseStyled = styled.div`
flex-direction: column;
margin-top: 10px;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 10px;
cursor: pointer;
align-items: stretch;
@ -29,26 +24,34 @@ const CourseStyled = styled.div`
`;
const CourseNameStyled = styled.div`
padding-top:20px;
padding-bottom:10px;
padding-left:35px;
padding-right:35px;
padding-top: 25px;
padding-bottom: 5px;
font-size: 16px;
`;
const ClassGroupStyled = styled.div`
position: relative;
padding-top: 1px;
padding-bottom: 1px;
:hover {
cursor: pointer;
background-color:#9ED3FF;
background-color: #9ed3ff;
}
`;
const ClassExandIconStyled = styled.img<ClassExandIconProps>`
margin-top: 5px;
interface ExpandIconProps {
isSelected: boolean;
}
const Flexbox = styled.div`
padding-bottom: 5px;
padding-top: 5px;
display: flex;
justify-content: center;
align-items: center;
`;
const Expand = styled.img<ExpandIconProps>`
width: 20px;
transition: 0.2s;
transform: ${(props) => (props.isSelected ? 'scaleY(-1);' : 'scaleY(1);')};
@ -58,7 +61,7 @@ const TypeClass = styled.div`
font-size: 12px;
position: absolute;
border-radius: 15px;
background-color:#00506B;
background-color: #00506b;
border: 2px solid;
min-width: 45px;
top: 5px;
@ -117,16 +120,16 @@ export const CourseCard = ({ course }: CourseCardProps) => {
.sort((a, b) => b.type.localeCompare(a.type))
.map((group, index) => (
<ClassGroupStyled key={index} onClick={() => onGroupClick(group, course.id)}>
<TypeClass>{group.type==="CLASS"? "Ćw." : "Wyk."}</TypeClass>
<TypeClass>{group.type === 'CLASS' ? 'Ćw.' : 'Wyk.'}</TypeClass>
<p>
{group.time} {group.room} <br></br> {group.lecturer}
</p>
</ClassGroupStyled>
))}
</Collapse>
<div onClick={() => setSelected(!isSelected)}>
<ClassExandIconStyled isSelected={isSelected} alt="expand" src={ExpandIcon} />
</div>
<Flexbox onClick={() => setSelected(!isSelected)}>
<Expand isSelected={isSelected} alt="expand" src={ExpandIcon} />
</Flexbox>
</CourseStyled>
);
};

View File

@ -26,20 +26,14 @@ const RightbarStyled = styled.div`
border: 1px solid;
}
`;
const RightbarTextStyled = styled.div`
display: flex;
flex-direction: column;
`;
const SaveButton = styled.div`
display: flex;
justify-content: center;
align-items: center;
background-color: #417cab !important;
background-color: #417cab;
border-radius: 10px;
cursor: pointer;
height: 40px;
background-color: red;
margin-bottom: 10px;
&:hover {
color: white;
@ -62,9 +56,7 @@ export const Rightbar = () => {
//need to insert student name from db and course maybe based on current time or from db too
return (
<RightbarStyled>
<RightbarTextStyled>
<SaveButton onClick={handleSave}>ZAPISZ</SaveButton>
</RightbarTextStyled>
{filteredCourses.map((course, index) => (
<CourseCard course={course} key={index} />
))}