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

View File

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