Skip to content

Commit

Permalink
added logo to navbar and removed all arrow navigation code
Browse files Browse the repository at this point in the history
  • Loading branch information
pranay-sharma793 committed Sep 17, 2024
1 parent 61db45a commit 88ffb26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 42 deletions.
Binary file added public/OurCode-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,6 @@ export const updateFilePath = (filePath) => {
};


/*
nav-bar navigation
*/


export const clickedOnForward = () => {
return {type: reduxStoreActions.action_click_forward};
};

export const clickedOnBack = () => {
return {type: reduxStoreActions.action_click_back};
};

/*
RulePad
*/
Expand Down
12 changes: 12 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,22 @@ body {
justify-content: center;
}

/*-- Nav bar --*/

.navbar {
margin-bottom: 0;
}

.navbar-brand {
display: flex;
align-items: center;
}

.navbar-icon {
width: 40px;
height: 40px;
}

/*!*** rule Generator GUI ***!*/

.guiBoundingBox {
Expand Down
39 changes: 10 additions & 29 deletions src/ui/navBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@

import React, {Component} from "react";
import "../App.css";
import {FaArrowLeft, FaArrowRight} from "react-icons/fa";
import {Nav, Navbar, NavItem} from "react-bootstrap";
import {connect} from "react-redux";
import {clickedOnBack, clickedOnForward} from "../actions";
import {hashConst} from "./uiConstants";
import {featureConfig} from "../config";

export class NavBar extends Component {
render() {
return (
<Navbar inverse collapseOnSelect
style={{backgroundColor: "transparent", backgroundImage: "none", border: "none"}}>
<Navbar.Toggle/>
<Navbar inverse collapseOnSelect style={{backgroundColor: "transparent", backgroundImage: "none", border: "none"}}>
<Navbar.Header>
<Navbar.Brand>
<a href="#/index">
<img src="/OurCode-icon.png" alt="Logo" className="navbar-icon grayscale"/>
</a>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
<Navbar.Collapse>
<Nav
onSelect={(key) => {
Expand All @@ -26,12 +30,6 @@ export class NavBar extends Component {
(key === 3) ? `#/${hashConst.violatedRules}` : (key === 4) ? `#/${hashConst.learnDesignRules}` : `#/${hashConst.index}`;
}
}}>
<NavItem eventKey={-1} className={this.props.backDisable} onClick={() => this.props.backClick(this.props)}>
<FaArrowLeft size={20}/>
</NavItem>
<NavItem eventKey={-2} className={this.props.forwardDisable} onClick={() => this.props.forwardClick(this.props)}>
<FaArrowRight size={20}/>
</NavItem>

<NavItem eventKey={1}>
{"Table of Contents"}
Expand Down Expand Up @@ -62,21 +60,4 @@ function mapStateToProps(state) {
};
}

function mapDispatchToProps(dispatch) {
return {
backClick: (props) => {
if (props.activeHashIndex > 0) {
dispatch(clickedOnBack());
window.location.hash = props.history[props.activeHashIndex - 1];
}
},
forwardClick: (props) => {
if (props.activeHashIndex < props.history.length - 1) {
dispatch(clickedOnForward());
window.location.hash = props.history[props.activeHashIndex + 1];
}
},
};
}

export default connect(mapStateToProps, mapDispatchToProps)(NavBar);
export default connect(mapStateToProps)(NavBar);

0 comments on commit 88ffb26

Please sign in to comment.