diff --git a/public/img/marist.webp b/public/img/marist.webp new file mode 100644 index 0000000..6cc77d1 Binary files /dev/null and b/public/img/marist.webp differ diff --git a/src/actions/index.js b/src/actions/index.js index a651d41..8d6a4b9 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -49,4 +49,28 @@ export const getRepoLanguages = (username, repoName) => async (dispatch, getStat type: 'GET_LANGUAGES', payload: payload, }); +} + +export const setIntro = (start=true) => async (dispatch, getState) => { + + dispatch({ + type: 'SET_INTRO', + payload: start, + }); +} + +export const hideNavigation = () => async (dispatch, getState) => { + + dispatch({ + type: 'SET_NAVIGATION', + payload: false, + }); +} + +export const showNavigation = () => async (dispatch, getState) => { + + dispatch({ + type: 'SET_NAVIGATION', + payload: true, + }); } \ No newline at end of file diff --git a/src/components/App.js b/src/components/App.js index 60b8fca..d82e8da 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -5,6 +5,7 @@ import Navigation from './Navigation'; import Home from './Home'; import Github from './Github'; import About from './About'; +import Intro from './Intro'; const App = (props) => { return ( @@ -15,6 +16,7 @@ const App = (props) => { } /> + diff --git a/src/components/Intro.js b/src/components/Intro.js new file mode 100644 index 0000000..b1f35fd --- /dev/null +++ b/src/components/Intro.js @@ -0,0 +1,132 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import './css/Intro.css'; +import {hideNavigation, showNavigation} from '../actions'; +import Topic from './subcomponents/Topic'; + +class Intro extends React.Component { + constructor() { + super(); + this.state = { + start: false, + prev: 'previous', + curr: 'current', + next: 'next', + prevLoc: -1, + currLoc: 0, + nextLoc: 1, + + }; + } + + handleKey = (e) => { + switch(e.key) { + case "ArrowUp": + this.handleInput('up'); + break; + case "ArrowDown": + this.handleInput('down') + break; + } + } + + handleInput = (input) => { + console.log(this.state.prevLoc); + console.log(this.state.currLoc) + console.log(this.state.nextLoc) + if (input === "up" && this.state.currLoc > 0) { + this.setState({ + prev: 'current', + curr: 'next', + }); + setTimeout(()=>{ + this.setState({ + prev: 'previous notrans', + curr: 'current notrans', + prevLoc: this.state.prevLoc-1, + currLoc: this.state.currLoc-1, + nextLoc: this.state.nextLoc-1, + }); + setTimeout(()=>{ + this.setState({ + prev: 'previous', + curr: 'current', + }); + }, 20); + }, 500); + } else if (input === "down" && this.state.nextLoc < this.topics.length) { + this.setState({ + curr: 'previous', + next: 'current' + }); + setTimeout(()=>{ + this.setState({ + curr: 'current notrans', + next: 'next notrans', + prevLoc: this.state.prevLoc+1, + currLoc: this.state.currLoc+1, + nextLoc: this.state.nextLoc+1, + }); + setTimeout(()=>{ + this.setState({ + curr: 'current', + next: 'next', + }); + }, 20); + }, 500); + + } else if (input === "down" && this.state.nextLoc >= this.topics.length) { + // Set something to happen when you reach the end + + } + + }; + + topics = [ + + Marist.edu + , + + , + + Explore Cam's Projects + + ]; + + render() { + + return ( +
+ +
+ {this.topics[this.state.currLoc]} +
+ +
+ ); + } + + componentDidMount() { + setTimeout(()=>{ + this.setState({ + start: true, + }); + }, 100); + + document.title = "Introduction"; + + this.props.hideNavigation(); + + } +} + +const mapStateToProps = (state) => { + return {}; +} + + +export default connect(mapStateToProps, {hideNavigation, showNavigation})(Intro); diff --git a/src/components/Navigation.js b/src/components/Navigation.js index 6b571c7..7b49567 100644 --- a/src/components/Navigation.js +++ b/src/components/Navigation.js @@ -3,36 +3,43 @@ import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import {toggleContactModal} from '../actions' import './css/Navigation.css'; -import { HouseDoor, FileEarmarkPerson, Github, Envelope } from 'react-bootstrap-icons'; +import { HouseDoor, FileEarmarkPerson, Github, Envelope, Flag} from 'react-bootstrap-icons'; import ContactModal from './subcomponents/ContactModal'; const Navigation = (props) => { + if (props.enable){ + return ( +
+ + Home + + + + Github Repos + + + + About + + + + View the Intro + + + + +
+ ); + } - return ( -
- - Home - - - - Github Repos - - - - About - - - - -
- ); + return
; } const mapStateToProps = (state) => { - return {modal: state.contactModal.contactModal} + return {modal: state.contactModal.contactModal, enable: state.navigation.enable}; } export default connect(mapStateToProps, {toggleContactModal})(Navigation); diff --git a/src/components/css/Intro.css b/src/components/css/Intro.css new file mode 100644 index 0000000..b263bdd --- /dev/null +++ b/src/components/css/Intro.css @@ -0,0 +1,56 @@ +.intro { + opacity: 0; + transition: opacity 1s ease-in-out; + width:100vw; + height:100vh; + display:flex; +} + +.intro.start { + color:white; + opacity: 1; + transition: opacity 1s ease-in-out; +} + +.intro .previous { + opacity: 0; + height:0; + width:100vw; + display: flex; + position:fixed; + transition: opacity 500ms ease-out, height 500ms ease-out, top 500ms ease-out; + top:0; + left:0; + justify-content: center; + align-items: center; +} + +.intro .current { + opacity: 1; + height:100vh; + width:100vw; + display: flex; + position:fixed; + transition: opacity 500ms ease-in, height 500ms ease-in, top 500ms ease-in; + top:0; + left:0; + justify-content: center; + align-items: center; +} + +.intro .next { + opacity: 0; + height:0; + width:100vw; + display: flex; + position:fixed; + transition: opacity 500ms ease-out, height 500ms ease-out, top 500ms ease-out; + top:100vh; + left:0; + justify-content: center; + align-items: center; +} + +.notrans { + transition: none !important; +} \ No newline at end of file diff --git a/src/components/css/Topic.css b/src/components/css/Topic.css new file mode 100644 index 0000000..c9e9033 --- /dev/null +++ b/src/components/css/Topic.css @@ -0,0 +1,19 @@ +.topic { + height: 100vh; + width: 100vw; + background-size:cover; + display:flex; + align-items:center; + +} + +.topic .content { + width: 100vw; + background: rgba(57, 57, 57, 0.75); + padding:0; + margin:0; + padding: 10px; + height:fit-content; +} + +.topic {} \ No newline at end of file diff --git a/src/components/subcomponents/Topic.js b/src/components/subcomponents/Topic.js new file mode 100644 index 0000000..d40355a --- /dev/null +++ b/src/components/subcomponents/Topic.js @@ -0,0 +1,29 @@ +import React from 'react'; +import '../css/Topic.css'; + +const Card = (props) => { + /** + * Topic - A window to contain topics for the intro component. Topic requires a title and some + * jsx passed between the two Card tags as props. + * + * title - title that will be displayed at the top of the card + * children - jsx that will be displayed in the content of the card + * background - a url to the background image + * + */ + return ( + + ); +}; + +export default Card; \ No newline at end of file diff --git a/src/reducers/index.js b/src/reducers/index.js index 3f8493f..057fa09 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -2,8 +2,12 @@ import { combineReducers } from "redux"; import githubReducer from './githubReducer'; import contactModalReducer from "./contactModalReducer"; +import introReducer from "./introReducer"; +import navigationReducer from "./navigationReducer"; export default combineReducers({ github: githubReducer, contactModal: contactModalReducer, + intro: introReducer, + navigation: navigationReducer, }); diff --git a/src/reducers/introReducer.js b/src/reducers/introReducer.js new file mode 100644 index 0000000..13b8a35 --- /dev/null +++ b/src/reducers/introReducer.js @@ -0,0 +1,11 @@ +let introReducer = (state={start: false}, action) => { + switch(action.type) { + case 'SET_INTRO': + return { ...state, start: action.payload }; + default: + return state; + } + }; + + +export default introReducer; \ No newline at end of file diff --git a/src/reducers/navigationReducer.js b/src/reducers/navigationReducer.js new file mode 100644 index 0000000..44d22df --- /dev/null +++ b/src/reducers/navigationReducer.js @@ -0,0 +1,11 @@ +let navigationReducer = (state={enable: true}, action) => { + switch(action.type) { + case 'SET_NAVIGATION': + return { ...state, enable: action.payload }; + default: + return state; + } + }; + + +export default navigationReducer; \ No newline at end of file