Carousel skeleton completed
This commit is contained in:
parent
7b3177a8e2
commit
c38439a233
9 changed files with 195 additions and 41 deletions
|
@ -4,7 +4,7 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack & tsc",
|
"build": "webpack & tsc & time /T",
|
||||||
"watch": "npm-watch build"
|
"watch": "npm-watch build"
|
||||||
},
|
},
|
||||||
"watch": {
|
"watch": {
|
||||||
|
|
23
src/public/components/Carousel.tsx
Normal file
23
src/public/components/Carousel.tsx
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import {Component} from "react";
|
||||||
|
|
||||||
|
interface CarouselProps {}
|
||||||
|
interface CarouselState {}
|
||||||
|
|
||||||
|
export default class Carousel extends Component<CarouselProps, CarouselState> {
|
||||||
|
constructor(props: CarouselProps) {
|
||||||
|
super(props);
|
||||||
|
this.state = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
private scrollToNext(e: MouseEvent) {
|
||||||
|
// implement later
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return <div className="carousel">
|
||||||
|
{this.props.children}
|
||||||
|
<div className="carousel-next" onClick={this.scrollToNext.bind(this)}>></div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
23
src/public/components/CarouselItem.tsx
Normal file
23
src/public/components/CarouselItem.tsx
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import {Component} from "react";
|
||||||
|
|
||||||
|
interface CarouselItemProps {
|
||||||
|
location: string;
|
||||||
|
workshopName: string;
|
||||||
|
image: string;
|
||||||
|
}
|
||||||
|
interface CarouselItemState {}
|
||||||
|
|
||||||
|
export default class CarouselItem extends Component<CarouselItemProps, CarouselItemState> {
|
||||||
|
constructor(props: CarouselItemProps) {
|
||||||
|
super(props);
|
||||||
|
this.state = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return <div className="carousel-item">
|
||||||
|
<img src={this.props.image}></img>
|
||||||
|
<a href={this.props.location}>{this.props.workshopName}</a>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ import React, {Component} from "react";
|
||||||
interface HorizontalSectionProps {
|
interface HorizontalSectionProps {
|
||||||
link: string;
|
link: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
row?: boolean;
|
||||||
}
|
}
|
||||||
interface HorizontalSectionState {}
|
interface HorizontalSectionState {}
|
||||||
|
|
||||||
|
@ -15,7 +16,9 @@ export default class HorizontalSection extends Component<HorizontalSectionProps,
|
||||||
public render() {
|
public render() {
|
||||||
return <div className="horizontal-section">
|
return <div className="horizontal-section">
|
||||||
<a className="section-title" href={this.props.link}>{this.props.title}</a>
|
<a className="section-title" href={this.props.link}>{this.props.title}</a>
|
||||||
|
<div className={this.props.row ? "row-group" : "col-group"}>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
|
|
||||||
interface ImageGalleryProps {
|
interface ImageSlideshowProps {
|
||||||
urls: string[];
|
urls: string[];
|
||||||
delay: number;
|
delay: number;
|
||||||
alt: string;
|
alt: string;
|
||||||
}
|
}
|
||||||
interface ImageGalleryState {
|
interface ImageSlideshowState {
|
||||||
progress: number;
|
progress: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ImageGallery extends Component<ImageGalleryProps, ImageGalleryState> {
|
export default class ImageSlideshow extends Component<ImageSlideshowProps, ImageSlideshowState> {
|
||||||
private interval: number;
|
private interval: number;
|
||||||
|
|
||||||
constructor(props: ImageGalleryProps) {
|
constructor(props: ImageSlideshowProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
progress: 0
|
progress: 0
|
||||||
|
@ -21,7 +21,7 @@ export default class ImageGallery extends Component<ImageGalleryProps, ImageGall
|
||||||
}
|
}
|
||||||
|
|
||||||
private changeImage(): void {
|
private changeImage(): void {
|
||||||
if (this.state.progress < this.props.urls.length) {
|
if (this.state.progress < this.props.urls.length - 1) {
|
||||||
this.setState({progress: this.state.progress + 1});
|
this.setState({progress: this.state.progress + 1});
|
||||||
} else {
|
} else {
|
||||||
this.setState({progress: 0});
|
this.setState({progress: 0});
|
||||||
|
@ -29,7 +29,7 @@ export default class ImageGallery extends Component<ImageGalleryProps, ImageGall
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return <div className="image-gallery">
|
return <div className="image-slideshow">
|
||||||
<img className="slideshow-image" src={this.props.urls[this.state.progress]} alt={this.props.alt}></img>
|
<img className="slideshow-image" src={this.props.urls[this.state.progress]} alt={this.props.alt}></img>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
|
@ -20,8 +20,11 @@ export default class TopNav extends React.Component<TopNavProps, TopNavState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div className="top-nav">
|
return <div className="top-nav">
|
||||||
|
<div className="nav-container">
|
||||||
<img className="logo" src={this.props.image} alt={this.props.alt}></img>
|
<img className="logo" src={this.props.image} alt={this.props.alt}></img>
|
||||||
{navLinks}
|
{navLinks}
|
||||||
|
</div>
|
||||||
|
<div className="bottom-bar"></div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,4 @@
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 10px;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-button,
|
|
||||||
::-webkit-scrollbar-corner {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: #ececec;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: #e2e2e2;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb:active {
|
|
||||||
background: #b8b8b8;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background: #383838;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Color vars should go here */
|
/* Color vars should go here */
|
||||||
:root {
|
:root {
|
||||||
|
@ -26,8 +8,23 @@
|
||||||
--grey: #c4d2e3;
|
--grey: #c4d2e3;
|
||||||
--black: #1f1f1f;
|
--black: #1f1f1f;
|
||||||
--white: #eeeeee;
|
--white: #eeeeee;
|
||||||
|
--accent: #ffe419;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
scrollbar-width: auto;
|
||||||
|
scrollbar-color: var(--black) transparent;
|
||||||
|
}
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 0.6em;
|
||||||
|
}
|
||||||
|
*::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--black);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
html {
|
html {
|
||||||
color: var(--black);
|
color: var(--black);
|
||||||
font-family: "Open Sans", sans-serif;
|
font-family: "Open Sans", sans-serif;
|
||||||
|
@ -36,13 +33,14 @@ body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Top nav styles */
|
||||||
.top-nav {
|
.top-nav {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
background-color: var(--dark-blue);
|
background-color: var(--dark-blue);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: fixed;
|
position: relative;
|
||||||
}
|
}
|
||||||
.logo {
|
.logo {
|
||||||
width: 10em;
|
width: 10em;
|
||||||
|
@ -56,10 +54,75 @@ body {
|
||||||
margin-right: 0.75em;
|
margin-right: 0.75em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav .nav-link:nth-of-type(1) {
|
.top-nav .nav-link:nth-of-type(1) {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
.bottom-bar {
|
||||||
|
width: 100%;
|
||||||
|
height: 0.25em;
|
||||||
|
background-color: var(--accent);
|
||||||
|
}
|
||||||
|
.nav-container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
.horizontal-section {
|
||||||
|
padding: 2em;
|
||||||
|
width: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 15%;
|
||||||
|
padding-right: 15%;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.column-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.row-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
color: var(--med-blue);
|
||||||
|
font-size: 2.2em;
|
||||||
|
text-decoration: none;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.section-title:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.carousel-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 1em;
|
||||||
|
background: ghostwhite;
|
||||||
|
box-shadow: 3px 3px 5px 1px grey;
|
||||||
|
margin: 0 1em;
|
||||||
|
}
|
||||||
|
.carousel {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 1em 0;
|
||||||
|
}
|
||||||
|
.carousel :first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.carousel :last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Image slideshow styles */
|
||||||
|
.slideshow-image {
|
||||||
|
width: 22em;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.image-slideshow {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Responsive queries go here */
|
/* Responsive queries go here */
|
||||||
@media screen and (max-width: 760px) {
|
@media screen and (max-width: 760px) {
|
||||||
|
|
BIN
src/public/img/event.png
Normal file
BIN
src/public/img/event.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
|
@ -2,9 +2,39 @@ import * as ReactDom from "react-dom";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import TopNav from "./components/TopNav";
|
import TopNav from "./components/TopNav";
|
||||||
import HorizontalSection from "./components/HorizontalSection";
|
import HorizontalSection from "./components/HorizontalSection";
|
||||||
import ImageGallery from "./components/ImageGallery";
|
import ImageGallery from "./components/ImageSlideshow";
|
||||||
|
import Carousel from "./components/Carousel";
|
||||||
|
import CarouselItem from "./components/CarouselItem";
|
||||||
|
|
||||||
const ACTIVE_PAGES = ["Events","Officers","Projects","Resources","Sponsors"];
|
// The links that are on the top nav bar that link to a lowercase version of their page
|
||||||
|
const ACTIVE_PAGES: string[] = ["About","Events","Officers","Projects","Resources","Sponsors"];
|
||||||
|
// Urls of team photos that will go in the "About" slideshow
|
||||||
|
const TEAM_PHOTOS: string[] = [
|
||||||
|
"https://dummyimage.com/600x400/000/fff.png&text=image1",
|
||||||
|
"https://dummyimage.com/300x200/000/fff.png&text=image2",
|
||||||
|
"https://dummyimage.com/1200x800/000/fff.png&text=image3"
|
||||||
|
];
|
||||||
|
const EVENTS = [{
|
||||||
|
image: "img/event.png",
|
||||||
|
workshopName: "Workshop Name",
|
||||||
|
location: "/"
|
||||||
|
},{
|
||||||
|
image: "img/event.png",
|
||||||
|
workshopName: "Workshop Name",
|
||||||
|
location: "/"
|
||||||
|
},{
|
||||||
|
image: "img/event.png",
|
||||||
|
workshopName: "Workshop Name",
|
||||||
|
location: "/"
|
||||||
|
},{
|
||||||
|
image: "img/event.png",
|
||||||
|
workshopName: "Workshop Name",
|
||||||
|
location: "/"
|
||||||
|
},{
|
||||||
|
image: "img/event.png",
|
||||||
|
workshopName: "Workshop Name",
|
||||||
|
location: "/"
|
||||||
|
}];
|
||||||
|
|
||||||
interface MainProps {}
|
interface MainProps {}
|
||||||
interface MainState {}
|
interface MainState {}
|
||||||
|
@ -16,13 +46,22 @@ class Main extends React.Component<MainProps, MainState> {
|
||||||
}
|
}
|
||||||
public render() {
|
public render() {
|
||||||
return <>
|
return <>
|
||||||
<TopNav names={ACTIVE_PAGES} links={ACTIVE_PAGES.map(e=>"/" + e.toLowerCase())} image="img/logo.png" alt="IEEE at UCSD Logo"></TopNav>
|
<TopNav names={ACTIVE_PAGES} links={ACTIVE_PAGES.map(e=>"#" + e.toLowerCase())} image="img/logo.png" alt="IEEE at UCSD Logo"></TopNav>
|
||||||
|
<HorizontalSection title="About" link="about:blank" row={true}>
|
||||||
|
<ImageGallery urls={TEAM_PHOTOS} alt="Team photos" delay={8000}></ImageGallery>
|
||||||
|
This is the about IEEE text that should describe all about our organization.
|
||||||
|
This text should be a succinct summary of what we're all about. Lorem, ipsum dolor
|
||||||
|
sit amet consectetur adipisicing elit. Soluta voluptate eligendi vero enim, qui
|
||||||
|
fugiat eveniet consectetur quis, quas deleniti perferendis minus commodi ducimus
|
||||||
|
ipsum necessitatibus voluptates sed dolor neque?
|
||||||
|
</HorizontalSection>
|
||||||
|
<HorizontalSection title="Events" link="about:blank">
|
||||||
|
<Carousel>
|
||||||
|
{EVENTS.map(e=><CarouselItem {...e}/>)}
|
||||||
|
</Carousel>
|
||||||
|
</HorizontalSection>
|
||||||
|
<HorizontalSection title="Project Space" link="about:blank">
|
||||||
|
|
||||||
<HorizontalSection title="About" link="about:blank">
|
|
||||||
<ImageGallery urls={["https://images.unsplash.com/photo-1637266702043-287eb7d2b5b2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1332&q=80",
|
|
||||||
"https://images.unsplash.com/photo-1637278643503-3a49c91b7000?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80",
|
|
||||||
"https://images.unsplash.com/photo-1637278643503-3a49c91b7000?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80"]}
|
|
||||||
alt="Team photos" delay={2000}></ImageGallery>
|
|
||||||
</HorizontalSection>
|
</HorizontalSection>
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue