table ready

This commit is contained in:
Maciek Głowacki 2020-11-08 18:05:21 +01:00
parent 26d6056a2b
commit cdbbeecc70
6 changed files with 77 additions and 44 deletions

View File

@ -8,6 +8,8 @@ import styled from 'styled-components';
const Wrapper = styled.div` const Wrapper = styled.div`
display: flex; display: flex;
height: calc(100vh - 80px); height: calc(100vh - 80px);
background-color: #ECEEF4;
padding: 20px;
`; `;
export const App = () => { export const App = () => {

View File

@ -12,9 +12,8 @@ export const Profile = ({ anchorEl, handleClose }: ProfileProps) => {
return ( return (
<Menu anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}> <Menu anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
<MenuItem>Profile</MenuItem> <MenuItem>Profil</MenuItem>
<MenuItem>My account</MenuItem> <MenuItem onClick={logout}>Wyloguj</MenuItem>
<MenuItem onClick={logout}>Logout</MenuItem>
</Menu> </Menu>
); );
}; };

View File

@ -25,6 +25,9 @@ const RightbarStyled = styled.div`
background-color: black; background-color: black;
border: 1px solid; border: 1px solid;
} }
background-color: white;
border-radius: 5px;
box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.59);
`; `;
const SaveButton = styled.div` const SaveButton = styled.div`
display: flex; display: flex;

View File

@ -5,8 +5,17 @@ import { days, hours } from '../constants/index';
import styled from 'styled-components/macro'; import styled from 'styled-components/macro';
const SchedulerWrapper = styled.div` const SchedulerWrapper = styled.div`
display: flex;
border-collapse: collapse; border-collapse: collapse;
flex: 1; flex: 1;
background-color: white;
padding: 5px 15px 5px 5px;
border-radius: 5px;
margin-right: 20px;
flex-direction: column;
justify-content: center;
align-items: center;
box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.59);
`; `;
const TableBody = styled.div` const TableBody = styled.div`
@ -31,10 +40,9 @@ interface TableCellProps {
const TableCell = styled.div<TableCellProps>` const TableCell = styled.div<TableCellProps>`
height: ${({ height }) => height}px; height: ${({ height }) => height}px;
/* border: ${({ isHourColumn }) => !isHourColumn && '1px solid #ddd'}; */ border-width: ${({ isHourColumn }) => !isHourColumn && '2px'};
border-width: ${({ isHourColumn }) => !isHourColumn && '1px'}; border-style: ${({ isHourColumn }) => !isHourColumn && 'none solid dotted none'};
border-style: ${({ isHourColumn }) => !isHourColumn && 'solid dotted dotted dotted'}; border-color: rgb(242, 243, 245);
/* border-bottom: ${({ isHourColumn }) => !isHourColumn && '1px dotted #ddd'}; */
margin-top: ${({ isHourColumn, height }) => isHourColumn ? -(height / 2) : 0}px; margin-top: ${({ isHourColumn, height }) => isHourColumn ? -(height / 2) : 0}px;
display: flex; display: flex;
align-items: center; align-items: center;
@ -44,6 +52,10 @@ const TableCell = styled.div<TableCellProps>`
font-size: 0.75vw; font-size: 0.75vw;
user-select: none; user-select: none;
border-collapse:collapse; border-collapse:collapse;
:nth-child(2) {
border-left: 2px solid rgb(242, 243, 245);
}
font-weight: bold;
`; `;
@ -77,7 +89,7 @@ export const Scheduler = () => {
{day} {day}
</TableCell> </TableCell>
) : ( ) : (
<TableCell height={wrapperHeight / 26} key={indexCell} ref={cellRef}> <TableCell height={wrapperHeight / 26} style={{ borderStyle: 'none none solid none' }} key={indexCell} ref={cellRef}>
{day} {day}
</TableCell> </TableCell>
), ),
@ -91,11 +103,21 @@ export const Scheduler = () => {
<TableCell height={wrapperHeight / 26} isHourColumn={true} key={`${indexRow}${indexCell}`}> <TableCell height={wrapperHeight / 26} isHourColumn={true} key={`${indexRow}${indexCell}`}>
{value} {value}
</TableCell> </TableCell>
) : ( ) : indexRow === 23 ? (
<TableCell height={wrapperHeight / 26} style={{ borderBottom: '2px solid rgb(242, 243, 245)' }} key={`${indexRow}${indexCell}`}>
{value}
</TableCell>
) : indexCell === 5 ? (
<TableCell height={wrapperHeight / 26} key={`${indexRow}${indexCell}`}> <TableCell height={wrapperHeight / 26} key={`${indexRow}${indexCell}`}>
{value} {value}
</TableCell> </TableCell>
), ) : indexRow % 2 !== 0 ? (
<TableCell height={wrapperHeight / 26} style={{ borderBottom: '2px solid rgb(242, 243, 245)' }} key={`${indexRow}${indexCell}`}>
{value}
</TableCell>
) : <TableCell height={wrapperHeight / 26} key={`${indexRow}${indexCell}`}>
{value}
</TableCell>
)} )}
</TableRow> </TableRow>
))} ))}

View File

@ -1,7 +1,7 @@
import React, { useState, MouseEvent, ChangeEvent, useEffect } from 'react'; import React, { useState, MouseEvent, ChangeEvent, useEffect } from 'react';
import Transfer from '../assets/transfer.png'; import Transfer from '../assets/transfer.png';
import Search from '../assets/search.svg'; import Search from '../assets/search.svg';
import CloseIcon from '../assets/close.svg'; import { ReactComponent as Close } from '../assets/close.svg';
import ProfileIcon from '../assets/account.svg'; import ProfileIcon from '../assets/account.svg';
import { Profile } from './Profile'; import { Profile } from './Profile';
import { Dropdown } from './Dropdown'; import { Dropdown } from './Dropdown';
@ -11,7 +11,7 @@ import styled from 'styled-components/macro';
import ClickAwayListener from 'react-click-away-listener'; import ClickAwayListener from 'react-click-away-listener';
const Topbar = styled.div` const Topbar = styled.div`
background-color: #eceef4; background-color: #E3E5ED;
height: 80px; height: 80px;
padding: 5px; padding: 5px;
font-size: 24px; font-size: 24px;
@ -22,9 +22,10 @@ const Topbar = styled.div`
const LogoWrapper = styled.div` const LogoWrapper = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: flex-start;
align-items: center; align-items: center;
flex: 2; flex: 2;
margin-left: 10px;
`; `;
const Logo = styled.img` const Logo = styled.img`
@ -37,6 +38,8 @@ const Logo = styled.img`
`; `;
const Text = styled.div` const Text = styled.div`
margin-left: 10px;
font-size: 1.4rem;
user-select: none; user-select: none;
@media only screen and (max-width: 670px) { @media only screen and (max-width: 670px) {
display: none; display: none;
@ -46,7 +49,7 @@ const Text = styled.div`
const FlexboxColumn = styled.div` const FlexboxColumn = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 9; flex: 12;
`; `;
const InputWrapper = styled.div` const InputWrapper = styled.div`
@ -54,6 +57,7 @@ const InputWrapper = styled.div`
margin-top: 15px; margin-top: 15px;
background-color: #f2f4f7; background-color: #f2f4f7;
border-radius: 6px; border-radius: 6px;
align-items: center;
`; `;
const Input = styled.input` const Input = styled.input`
@ -61,40 +65,45 @@ const Input = styled.input`
font-size: 20px; font-size: 20px;
height: 40px; height: 40px;
width: 100%; width: 100%;
margin-left: 5px;
border: none; border: none;
margin-left: 5px;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
&:focus { &:focus {
outline: none; outline: none;
} }
`; `;
const InputIcon = styled.img` const CloseIcon = styled(Close)`
width: 30px; width: 30px;
height: 30px;
margin-right: 5px;
@media only screen and (max-width: 670px) { @media only screen and (max-width: 670px) {
width: 25px; width: 25px;
} }
cursor: pointer; cursor: pointer;
:hover {
fill: grey;
}
`; `;
const IconWrapper = styled.div` const IconWrapper = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: flex-end;
align-items: center; align-items: center;
flex: 2; width: 335px;
`; `;
const Icon = styled.img` const Icon = styled.img`
width: 40px; width: 40px;
margin: 5px;
cursor: pointer; cursor: pointer;
@media only screen and (max-width: 670px) { @media only screen and (max-width: 670px) {
width: 35px; width: 35px;
} }
`; `;
const VerticalLine = styled.div`
border-left: 1px solid black;
height: 30px;
`;
@ -139,20 +148,18 @@ export default function ({ handleTransfer }: TopbarProps) {
<ClickAwayListener onClickAway={handleClickAway}> <ClickAwayListener onClickAway={handleClickAway}>
<InputWrapper> <InputWrapper>
<Input placeholder="Wyszukaj przedmiot..." onChange={handleChange} onClick={handleClick} value={input} /> <Input placeholder="Wyszukaj przedmiot..." onChange={handleChange} onClick={handleClick} value={input} />
<InputIcon alt="close" src={CloseIcon} onClick={handleClearInput} /> <CloseIcon onClick={handleClearInput} />
<VerticalLine />
<InputIcon alt="search" src={Search} />
</InputWrapper> </InputWrapper>
<Dropdown open={open} input={input} handleCloseDropdown={handleCloseDropdown} /> <Dropdown open={open} input={input} handleCloseDropdown={handleCloseDropdown} />
</ClickAwayListener> </ClickAwayListener>
</FlexboxColumn> </FlexboxColumn>
<IconWrapper> <IconWrapper>
<Icon alt="transfer" src={Transfer} onClick={handleTransfer} /> {/* <Text>Maciej Głowacki</Text> */}
{/* <Icon alt="transfer" src={Transfer} onClick={handleTransfer} /> */}
<Icon alt="change_language" src={isPolish ? EnglishIcon : PolishIcon} onClick={onLangChange} /> <Icon alt="change_language" src={isPolish ? EnglishIcon : PolishIcon} onClick={onLangChange} />
<Icon alt="profile" src={ProfileIcon} onClick={handleProfile} /> <Icon alt="profile" src={ProfileIcon} onClick={handleProfile} />
<Profile anchorEl={anchorEl} handleClose={handleClose} /> <Profile anchorEl={anchorEl} handleClose={handleClose} />
<Text>nasz student</Text>
</IconWrapper> </IconWrapper>
</Topbar> </Topbar>
); );

View File

@ -8,29 +8,29 @@ export const days = [
]; ];
export const hours = [ export const hours = [
"8:00", "8:00",
"8:30", "",
"9:00", "9:00",
"9:30", "",
"10:00", "10:00",
"10:30", "",
"11:00", "11:00",
"11:30", "",
"12:00", "12:00",
"12:30", "",
"13:00", "13:00",
"13:30", "",
"14:00", "14:00",
"14:30", "",
"15:00", "15:00",
"15:30", "",
"16:00", "16:00",
"16:30", "",
"17:00", "17:00",
"17:30", "",
"18:00", "18:00",
"18:30", "",
"19:00", "19:00",
"19:30", "",
]; ];