Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 83 additions & 58 deletions src/resources/Resources.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,99 @@

import { useState } from "react";
import { BookOnline } from "@mui/icons-material";
import React, { useState, useEffect, useRef } from "react";
import { useLocation } from "react-router-dom";
import "./resources.css";
import Tutorials from './Tutorials.js';
import Research from './Research';
import Organizations from './Organizations';


const Resources = () => {
return (
<div className="resources-container">
<h1 className="resource-title">Resources</h1>
<Tab className="tab-components"/>
</div>
);
};
function Resources() {
return (
<div className="resources-container">
<Tab />
</div>
);
}
export default Resources;

function Tab() {
const [tabState, setTab] = useState(1)

const toggleTab = (index) => {
setTab(index)
}
const [tabState, setTab] = useState(1)

const toggleTab = (index) => {
setTab(index)
}

let location = useLocation();
useEffect(() => {
toggleTab(location.state.option);
}, [location]);
let location = useLocation();
useEffect(() => {
toggleTab(location.state.option);
}, [location]);

return (
<div className='tab-container'>
{/*
<Link to='/resources/tutorials' className='tab-button'>Tutorials</Link>
<Link to='resources/research' className='tab-button'>Research</Link>
<Link to='resources/organizations' className='tab-button'>Organizations</Link>
*/}
<div className='tabs'>
<button type='button' onClick={() => toggleTab(1)} className={tabState === 1 ? 'tab-button active' : 'tab-button'}>Tutorials</button>
<button type='button' onClick={() => toggleTab(2)} className={tabState === 2 ? 'tab-button active' : 'tab-button'}>Research</button>
<button type='button' onClick={() => toggleTab(3)} className={tabState === 3 ? 'tab-button active' : 'tab-button'}>Organizations</button>
</div>
const toggleTab = index => {
setTab(index);
};

<div className="tab-contents">
<div className={tabState === 1 ? 'tab-content active-content': 'tab-content'}>
<h2>Tutorials</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
</div>
return (
<>
<div className="resources-tabs">
<button
type="button"
onClick={() => toggleTab(1)}
className={tabState === 1 ? "active" : ""}
>
Tutorials
</button>
<button
type="button"
onClick={() => toggleTab(2)}
className={tabState === 2 ? "active" : ""}
>
Readings
</button>
<button
type="button"
onClick={() => toggleTab(3)}
className={tabState === 3 ? "active" : ""}
>
Organizations
</button>
</div>
<div className="resources-contents">
<div
className={
tabState === 1 ? "resources-content active" : "resources-content"
}
>
<h2>Tutorials</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
</p>
</div>

<div className={tabState === 2 ? 'tab-content active-content': 'tab-content'}>
<h2>Research</h2>
<p>Something about Early Research Scholars Programs.
</p>
</div>
<div
className={
tabState === 2 ? "resources-content active" : "resources-content"
}
>
<h2>Readings</h2>
<p>Something about Early Research Scholars Programs.</p>
</div>

<div className={tabState === 3 ? 'tab-content active-content': 'tab-content'}>
<h2>Organizations</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
</div>
</div>
</div>
)
<div
className={
tabState === 3 ? "resources-content active" : "resources-content"
}
>
<h2>Organizations</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
</p>
</div>
</div>
</>
);
}

146 changes: 66 additions & 80 deletions src/resources/resources.css
Original file line number Diff line number Diff line change
@@ -1,105 +1,91 @@

h1 {
color: white;
/* Animation */
@keyframes arrivedContent {
0% {
right: -80rem;
opacity: 0;
}
100% {
right: 0rem;
opacity: 1;
}
}

/* Demo content */
/* .resources-wrapper {
width: 80vw;
display: flex;
justify-content: space-between;
}
.resources-info {
width: 30%;
background-color: rgb(102, 62, 202);
}
.resources-list li {
padding: 0;
margin: 0;
} */

/* Tab button */
.resource-container {
overflow: hidden;
flex-direction: column;
display: flex;
color: white;
height: 100%;
min-width: 400px;
margin: 20px 10rem;

}

.resource-tab-container {
display: flex;
justify-content: center;
align-items: center;
margin: 0rem 28rem 0rem 28rem;
background-color: black;
.resources-container {
overflow: hidden;
display: flex;
flex-direction: column;
margin: auto;
margin-top: 6rem;
width: 80%;
height: 1000px;
z-index: 3;
}

.resource-tab-btn {
height: 3rem;
font-size: 22px;
margin: 0rem 0.1rem 0rem 0.1rem;
padding: 2rem 6rem 3rem 6rem;
cursor: pointer;
color: #535353;
border: 0;
background-color: #ff9617;
text-decoration: none;
font-weight: bold;
z-index: 10;
.resources-container h1 {
margin: auto;
margin-bottom: 4rem;
color: white;
}

.resource-tab-btn.active {
text-decoration: underline;
color: white;
background-color:#535353;
.resources-tabs {
display: flex;
text-align: center;
}

.resource-tab-btn:hover {
color: #fff;
background-color: #535353;
.resources-tabs button {
display: block;
padding: 10px;
flex-grow: 1;
background: transparent;
color: #fff;
font-size: 22px;
font-weight: bold;
cursor: pointer;
text-decoration: none;
border: 0;
box-shadow: 0px 2px 0px 0px #ccc;
}

/* Tab content */
.resource-tab-contents {
flex-grow: 1;
z-index: 2;
.resources-tabs button.active {
background-color: #ff9617;
color: #212121;
transition: all 0.3s ease-in-out;
box-shadow: 0px 3px 0px 0px rgb(255, 150, 23);
}

.resource-tab-content {
background-color: #212121;
color: white; /* Will change due to switching tab*/
margin: 0rem 10rem 2rem 10rem;
padding: 2rem 15rem 2rem 15rem;
display: none;
justify-content: center;
border-radius: 20px;
box-shadow: 0 0 50px rgba(0,0,0,10);
.resources-tabs button:hover {
transition: all 0.3s ease-in-out;
box-shadow: 0px 2px 0px 0px rgb(255, 150, 23, 0.8);
}

.resource-tab-text {
font-size: 20px;
/* Tab content */
.resource-contents {
flex-grow: 1;
overflow: auto;
z-index: 2;
}

.resource-tab-content.active {
display: block;
.resources-content {
color: white;
padding: 3rem 12% 2rem 12%;
display: none;
justify-content: center;
border-radius: 20px;
position: relative;
animation-name: arrivedContent;
animation-duration: 0.8s;
}

/* Mobile Responsive */
.resp-tab {
width: 400px;
.resources-content.active {
display: block;
}

.resp-tab-btn {
height: 3rem;
margin-right: 10px;
border-radius: none;
.pagination-container {
margin: auto;
display: flex;
}

.resp-tab-content {
margin: 1rem 1rem 2rem 1rem;
}
/* TODO: Add pagination css */

1 change: 1 addition & 0 deletions src/resources/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// For pagination