styled components
This commit is contained in:
		@@ -1,31 +0,0 @@
 | 
			
		||||
.right-bar {
 | 
			
		||||
    padding-top: 10px;
 | 
			
		||||
    padding-left: 15px;
 | 
			
		||||
    padding-right: 15px;
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    font-family: Lato;
 | 
			
		||||
    width: 300px;
 | 
			
		||||
    &__text {
 | 
			
		||||
      border-bottom: 1px solid;
 | 
			
		||||
    }
 | 
			
		||||
    height:85vh;
 | 
			
		||||
    overflow-y: scroll;
 | 
			
		||||
  }
 | 
			
		||||
  .right-bar::-webkit-scrollbar-track
 | 
			
		||||
{
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    background-color: #F5F5F5;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.right-bar::-webkit-scrollbar
 | 
			
		||||
{
 | 
			
		||||
    width: 12px;
 | 
			
		||||
    background-color: #F5F5F5;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.right-bar::-webkit-scrollbar-thumb
 | 
			
		||||
{
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    background-color: #d4b851;
 | 
			
		||||
    border: 1px solid;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +1,39 @@
 | 
			
		||||
import React, { useState, useContext } from 'react';
 | 
			
		||||
import './index.scss';
 | 
			
		||||
import { Course } from '../../types';
 | 
			
		||||
import { CourseCard } from './CourseCard/index';
 | 
			
		||||
import { coursesContext } from '../../contexts/CoursesProvider';
 | 
			
		||||
import styled from 'styled-components';
 | 
			
		||||
 | 
			
		||||
interface RightBarProps {
 | 
			
		||||
  onGroupMouseOver: (id: number, name: string) => void;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const RightBarStyled = styled.div`
 | 
			
		||||
  padding-top: 10px;
 | 
			
		||||
  padding-left: 15px;
 | 
			
		||||
  padding-right: 15px;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  font-family: Lato;
 | 
			
		||||
  width: 300px;
 | 
			
		||||
  height: 85vh;
 | 
			
		||||
  overflow-y: scroll;
 | 
			
		||||
  ::-webkit-scrollbar-track {
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    background-color: #f5f5f5;
 | 
			
		||||
  }
 | 
			
		||||
  ::-webkit-scrollbar {
 | 
			
		||||
    width: 12px;
 | 
			
		||||
    background-color: #f5f5f5;
 | 
			
		||||
  }
 | 
			
		||||
  ::-webkit-scrollbar-thumb {
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    background-color: #d4b851;
 | 
			
		||||
    border: 1px solid;
 | 
			
		||||
  }
 | 
			
		||||
`;
 | 
			
		||||
const RightBarTextStyled = styled.div`
 | 
			
		||||
  border-bottom: 1px solid;
 | 
			
		||||
`;
 | 
			
		||||
 | 
			
		||||
export default function RightBar({ onGroupMouseOver }: RightBarProps) {
 | 
			
		||||
  const [selectedCardId, setSelectedCardId] = useState<string | null>(null);
 | 
			
		||||
 | 
			
		||||
@@ -19,11 +45,11 @@ export default function RightBar({ onGroupMouseOver }: RightBarProps) {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <div className="right-bar">
 | 
			
		||||
      <div className="right-bar__text">
 | 
			
		||||
    <RightBarStyled>
 | 
			
		||||
      <RightBarTextStyled>
 | 
			
		||||
        Hubert Wrzesiński<br></br>
 | 
			
		||||
        Semestr zimowy 2020/2021
 | 
			
		||||
      </div>
 | 
			
		||||
      </RightBarTextStyled>
 | 
			
		||||
      {courses.map((course, index) => (
 | 
			
		||||
        <CourseCard
 | 
			
		||||
          course={course}
 | 
			
		||||
@@ -34,6 +60,6 @@ export default function RightBar({ onGroupMouseOver }: RightBarProps) {
 | 
			
		||||
          isSelected={selectedCardId === index.toString()}
 | 
			
		||||
        />
 | 
			
		||||
      ))}
 | 
			
		||||
    </div>
 | 
			
		||||
    </RightBarStyled>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,6 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) =>
 | 
			
		||||
    function mapGroupTimeToEventRow(groups: Array<Group>) {
 | 
			
		||||
      const groupsMappedToEventsTemp = [];
 | 
			
		||||
      for (const group of groups) {
 | 
			
		||||
        console.log(group);
 | 
			
		||||
        const groupTime = group.time;
 | 
			
		||||
        const eventRow: number = groupTimeToEventRowMapping[groupTime];
 | 
			
		||||
        const groupMappedToEvent: any = {
 | 
			
		||||
@@ -61,8 +60,6 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) =>
 | 
			
		||||
  }, [choosenGroups]);
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    console.log(choosenGroups);
 | 
			
		||||
    console.log(groupsMappedToEvents);
 | 
			
		||||
  }, [groupsMappedToEvents]);
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,8 @@ interface SchedulerRowProps {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: SchedulerRowProps) => {
 | 
			
		||||
  console.log(`You passed me these of a groupzzz: ${groups}`);
 | 
			
		||||
  console.log(`You passed me these of a groupzzz`);
 | 
			
		||||
  console.log(groups)
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
.course {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  z-index: 10;
 | 
			
		||||
  padding: 5px;
 | 
			
		||||
  padding-left: 20px;
 | 
			
		||||
  background-color: #e6c759;
 | 
			
		||||
  font-size: 18px;
 | 
			
		||||
  font-family: Lato;
 | 
			
		||||
}
 | 
			
		||||
.course:hover {
 | 
			
		||||
  background-color: #d4b851;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
.dropdown::-webkit-scrollbar {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
.dropdown {
 | 
			
		||||
  max-height: 400px;
 | 
			
		||||
  overflow-y: auto;
 | 
			
		||||
}
 | 
			
		||||
.top-bar__input-field {
 | 
			
		||||
  width: 100%;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,17 +1,48 @@
 | 
			
		||||
import React, { useState, useContext, useEffect } from 'react';
 | 
			
		||||
import axios from 'axios';
 | 
			
		||||
import { Input } from '@material-ui/core';
 | 
			
		||||
import './index.scss';
 | 
			
		||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener';
 | 
			
		||||
import { coursesContext } from '../../../contexts/CoursesProvider';
 | 
			
		||||
import { Course, Group } from '../../../types';
 | 
			
		||||
import { Course } from '../../../types';
 | 
			
		||||
import styled from 'styled-components';
 | 
			
		||||
import { makeStyles } from '@material-ui/core/styles';
 | 
			
		||||
 | 
			
		||||
interface courseData {
 | 
			
		||||
  name: string;
 | 
			
		||||
  id: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const CourseStyled = styled.div`
 | 
			
		||||
  position: relative;
 | 
			
		||||
  z-index: 10;
 | 
			
		||||
  padding: 5px;
 | 
			
		||||
  padding-left: 20px;
 | 
			
		||||
  background-color: #e6c759;
 | 
			
		||||
  font-size: 18px;
 | 
			
		||||
  font-family: Lato;
 | 
			
		||||
  :hover {
 | 
			
		||||
    background-color: #d4b851;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
  }
 | 
			
		||||
`;
 | 
			
		||||
 | 
			
		||||
const Dropdown = styled.div`
 | 
			
		||||
  max-height: 400px;
 | 
			
		||||
  overflow-y: auto;
 | 
			
		||||
  ::-webkit-scrollbar {
 | 
			
		||||
    display: none;
 | 
			
		||||
  }
 | 
			
		||||
`;
 | 
			
		||||
 | 
			
		||||
const useStyles = makeStyles({
 | 
			
		||||
  topbarInput: {
 | 
			
		||||
    marginTop:"8px",
 | 
			
		||||
    width: '100%',
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export const Results: React.FC = () => {
 | 
			
		||||
  const classes = useStyles();
 | 
			
		||||
  const [input, setInput] = useState<string>('');
 | 
			
		||||
  const [coursesData, setcoursesData] = useState<Array<courseData>>([]);
 | 
			
		||||
  const [filteredcoursesData, setFilteredcoursesData] = useState<Array<courseData>>([]);
 | 
			
		||||
@@ -90,25 +121,26 @@ export const Results: React.FC = () => {
 | 
			
		||||
    // }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <ClickAwayListener onClickAway={handleClickAway}>
 | 
			
		||||
      <div>
 | 
			
		||||
        <Input
 | 
			
		||||
          placeholder="Wyszukaj..."
 | 
			
		||||
          inputProps={{ 'aria-label': 'description' }}
 | 
			
		||||
          className="top-bar__input-field"
 | 
			
		||||
          className={classes.topbarInput}
 | 
			
		||||
          onChange={handleChange}
 | 
			
		||||
          onClick={handleClick}
 | 
			
		||||
          value={input}
 | 
			
		||||
        />
 | 
			
		||||
        {open ? (
 | 
			
		||||
          <div className="dropdown">
 | 
			
		||||
          <Dropdown>
 | 
			
		||||
            {filteredcoursesData.map((course, index) => (
 | 
			
		||||
              <div className="course" key={index} id={String(course.id)} onClick={onCourseClick}>
 | 
			
		||||
              <CourseStyled key={index} id={String(course.id)} onClick={onCourseClick}>
 | 
			
		||||
                <p>{course.name} </p>
 | 
			
		||||
              </div>
 | 
			
		||||
              </CourseStyled>
 | 
			
		||||
            ))}
 | 
			
		||||
          </div>
 | 
			
		||||
          </Dropdown>
 | 
			
		||||
        ) : null}
 | 
			
		||||
      </div>
 | 
			
		||||
    </ClickAwayListener>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user