Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use font awesome chevrons instead of inline svg #1041

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"express-static-gzip": "^0.2.2",
"file-loader": "^1.1.11",
"font-awesome": "^4.7.0",
"react-icons": "^3.9.0",
"i18next": "^19.3.2",
"i18next-resource-store-loader": "^0.1.2",
"json-loader": "^0.5.1",
Expand Down
15 changes: 7 additions & 8 deletions src/components/narrative/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ReactPageScroller from "./ReactPageScroller";
import { changePage, EXPERIMENTAL_showMainDisplayMarkdown } from "../../actions/navigation";
import { CHANGE_URL_QUERY_BUT_NOT_REDUX_STATE } from "../../actions/types";
import { narrativeNavBarHeight } from "../../util/globals";
import { FaChevronUp, FaChevronDown } from "react-icons/fa";

/* regarding refs: https://reactjs.org/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components */
const progressHeight = 25;
Expand Down Expand Up @@ -96,26 +97,24 @@ class Narrative extends React.Component {
Mousetrap.bind(['right', 'down'], this.goToNextSlide);
}
renderChevron(pointUp) {
const dims = {w: 30, h: 30};
const width = 30;
const style = {
zIndex: 200,
position: "absolute",
cursor: "pointer",
left: `${this.props.width/2 - dims.w/2}px`
left: `${this.props.width/2 - width/2}px`,
fontSize: `${width}px`
};
if (pointUp) style.top = narrativeNavBarHeight + progressHeight;
if (!pointUp) style.bottom = "5px";
else style.bottom = 0;
const svgPathD = pointUp ?
"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z" :
"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z";
const icon = pointUp ? <FaChevronUp /> : <FaChevronDown />;
return (
<div id={`hand${pointUp?"Up":"Down"}`}
style={style}
onClick={pointUp ? this.goToPreviousSlide : this.goToNextSlide}
>
<svg width={`${dims.w}px`} height={`${dims.h}px`} viewBox="0 0 448 512">
<path d={svgPathD} fill="black"/>
</svg>
{icon}
</div>
);
}
Expand Down