From e1c2c1956fea7860d7b35f0f91b724f5f0b54faf Mon Sep 17 00:00:00 2001 From: Bharat Arimilli Date: Mon, 27 Apr 2020 01:27:27 -0500 Subject: [PATCH 1/3] Replace home page slide up with fade on text elements --- client/components/Animations/FadeIn.js | 32 +++++++++++++++++++++++++ client/components/Animations/SlideUp.js | 16 ++++++------- client/components/Animations/index.js | 2 ++ client/pages/index.js | 16 +++++++------ 4 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 client/components/Animations/FadeIn.js diff --git a/client/components/Animations/FadeIn.js b/client/components/Animations/FadeIn.js new file mode 100644 index 0000000..335cd10 --- /dev/null +++ b/client/components/Animations/FadeIn.js @@ -0,0 +1,32 @@ +import React, { useState, useEffect } from 'react'; + +const defaultStyle = { + transition: 'opacity 300ms ease-out', + opacity: 0, +}; + +const transitionStyles = { + entering: { + opacity: 0, + }, + entered: { + opacity: 1, + } +}; + +export default function FadeIn({ startAt, children }) { + const [display, setDisplay] = useState(false); + + useEffect(() => { + setTimeout(() => setDisplay(true), startAt); + }, []); + + return ( + React.cloneElement(children, { + style: { + ...defaultStyle, + ...transitionStyles[display ? 'entered' : 'entering'], + } + }) + ); +} diff --git a/client/components/Animations/SlideUp.js b/client/components/Animations/SlideUp.js index c791e90..44857e1 100644 --- a/client/components/Animations/SlideUp.js +++ b/client/components/Animations/SlideUp.js @@ -1,27 +1,27 @@ -import React, { useState, useEffect } from "react"; -import { Transition } from "react-transition-group"; +import React, { useState, useEffect } from 'react'; +import { Transition } from 'react-transition-group'; const defaultStyle = { - transition: "all 300ms ease-out", + transition: 'all 300ms ease-out', opacity: 0, }; const transitionStyles = { entering: { opacity: 0, - transform: "translateY(20%)", + transform: 'translateY(20%)', }, entered: { opacity: 1, - transform: "translateY(0%)", + transform: 'translateY(0%)', }, exiting: { opacity: 1, - transform: "translateY(0%)", + transform: 'translateY(0%)', }, exited: { opacity: 0, - transform: "scale(0.9) translateY(50%)", + transform: 'scale(0.9) translateY(50%)', }, }; @@ -39,7 +39,7 @@ export default function SlideUp({ startAt, children }) { style: { ...defaultStyle, ...transitionStyles[state], - } + }, }) } diff --git a/client/components/Animations/index.js b/client/components/Animations/index.js index 4248fd2..398d249 100644 --- a/client/components/Animations/index.js +++ b/client/components/Animations/index.js @@ -1,5 +1,7 @@ import SlideUp from './SlideUp'; +import FadeIn from './FadeIn'; export default { SlideUp, + FadeIn, }; diff --git a/client/pages/index.js b/client/pages/index.js index 55ac257..b3ad6a4 100644 --- a/client/pages/index.js +++ b/client/pages/index.js @@ -2,9 +2,9 @@ import React from 'react'; import Router from 'next/router'; import styled from 'styled-components'; import { Core, Form, Animations } from '../components'; -import { Row, Col } from 'antd'; +import { Col } from 'antd'; -const { SlideUp } = Animations; +const { FadeIn } = Animations; const Content = styled.div` display: block; @@ -54,13 +54,15 @@ export default function Home() {
- - + +
UTD Grades
+
+ See how students did in any given class. And it's free, forever. -
- - + + +
From 951d13a5fb816c3adbdc532d8c5075a09cca59ea Mon Sep 17 00:00:00 2001 From: Bharat Arimilli Date: Mon, 27 Apr 2020 01:30:47 -0500 Subject: [PATCH 2/3] Add professor-only queries to tests --- .../section/find/__tests__/integration.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/functions/services/section/find/__tests__/integration.test.js b/functions/services/section/find/__tests__/integration.test.js index d48f748..2b79daa 100644 --- a/functions/services/section/find/__tests__/integration.test.js +++ b/functions/services/section/find/__tests__/integration.test.js @@ -102,6 +102,22 @@ describe('Test sample queries', () => { } }); + test('Should handle professor-only', async () => { + const queries = [ + { search: 'Stephen Perkins', expected: { professorFirstName: 'Stephen J', professorLastName: 'Perkins' } }, + { search: 'Kristen Lawson', expected: { professorFirstName: 'Kristen A', professorLastName: 'Lawson' } } + ]; + + for (let i = 0; i < queries.length; i++) { + const { search, expected } = queries[i]; + const response = await find({ search }, connection); + + expect(response).not.toHaveLength(0); + expect(response[0].professor.firstName).toEqual(expected.professorFirstName); + expect(response[0].professor.lastName).toEqual(expected.professorLastName); + } + }); + test('Should handle everything together', async () => { const queries = [ { search: 'CS 1337 502 fall 2019 Stephen Perkins', expected: { coursePrefix: 'CS', courseNumber: '1337', sectionNumber: '501', semesterType: 'fall', year: 2019, professorFirstName: 'Stephen J', professorLastName: 'Perkins' } }, From fbe382c19effb35b52c9dcf461fe8b3a32049af5 Mon Sep 17 00:00:00 2001 From: Bharat Arimilli Date: Mon, 27 Apr 2020 01:32:08 -0500 Subject: [PATCH 3/3] Update package.json versions --- client/package.json | 2 +- functions/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/package.json b/client/package.json index 4590957..3434307 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "utd-grades-client", - "version": "1.2.1", + "version": "1.3.0", "private": true, "scripts": { "dev": "next dev", diff --git a/functions/package.json b/functions/package.json index a43eb04..af7e3a8 100644 --- a/functions/package.json +++ b/functions/package.json @@ -1,6 +1,6 @@ { "name": "utd-grades-functions", - "version": "1.1.0", + "version": "1.1.1", "description": "", "scripts": { "test": "jest",