Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 85bf289

Browse files
committed
buttons replaced by navigation icons
1 parent 152fd10 commit 85bf289

File tree

3 files changed

+66
-27
lines changed

3 files changed

+66
-27
lines changed

package-lock.json

Lines changed: 33 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "saffroncodejs",
3-
"version": "1.8.4",
3+
"version": "1.9.3",
44
"description": "Package of optimised react components and javascript functions for developers ♫♪",
55
"main": "./lib/SaffronCode.js",
66
"types": "./lib/SaffronCode.d.ts",
77
"directories": {
88
"doc": "doc"
99
},
1010
"scripts": {
11-
"build": "rmdir lib /s /q && tsc",
12-
"copy-files": "cp ./src/ ./dist/",
11+
"build": "rmdir lib /s /q && tsc",
12+
"copy-files": "cp ./src/ ./dist/",
1313
"test": "echo \"Error: no test specified\" && exit 1"
1414
},
1515
"repository": {
@@ -49,7 +49,10 @@
4949
"ReactRouter",
5050
"framework",
5151
"EventDispatcher",
52-
"ActionScript"
52+
"ActionScript",
53+
"ReactItemSlider",
54+
"ReactSlider",
55+
"ReactTagInput"
5356
],
5457
"author": "SaffronCode Co <ebrahimsepehr@gmail.com>",
5558
"license": "MIT",
@@ -58,6 +61,9 @@
5861
},
5962
"homepage": "https://github.com/SaffronCode/SaffronCodeJS#readme",
6063
"dependencies": {
64+
"@fortawesome/fontawesome-svg-core": "^1.2.32",
65+
"@fortawesome/free-solid-svg-icons": "^5.15.1",
66+
"@fortawesome/react-fontawesome": "^0.1.14",
6167
"@types/react": "^16.14.2",
6268
"@types/react-dom": "^16.9.10",
6369
"npm": "^6.14.10",

src/ui/ItemsSlider.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import React, { Component } from 'react'
2-
32
import './ItemsSlider.css';
43

4+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
5+
import {
6+
faChevronLeft,
7+
faChevronRight
8+
} from "@fortawesome/free-solid-svg-icons";
59
interface ItemSliderProps {
610
children: React.ReactNode,
711
id: string,
8-
rtl: boolean
12+
rtl: boolean,
13+
top: string,
14+
fontSize: string,
15+
color: string
916
}
1017

1118
export default class ItemsSlider extends Component<ItemSliderProps> {
@@ -139,32 +146,34 @@ export default class ItemsSlider extends Component<ItemSliderProps> {
139146
position: "relative"
140147
}
141148

149+
const top = (this.props.top) ? this.props.top : '39%';
150+
142151
const navButtonsStyle:object = {
143152
position: "absolute",
144153
width: "100%",
145154
display: "flex",
146155
justifyContent: "space-between",
147-
top: "39%",
156+
top,
148157
left: "0"
149158
}
150159

160+
const fontSize = (this.props.fontSize) ? this.props.fontSize : '20px';
161+
162+
const iconsFontSize:object = {
163+
fontSize,
164+
cursor: 'pointer'
165+
}
166+
151167
return (
152168
<div>
153169
<div style={sliderContainer}>
154170
<div className="saffronJsSlider-13" id={this.props.id}>
171+
155172
{this.props.children}
173+
156174
<div style={navButtonsStyle}>
157-
<button
158-
disabled={this.state.beforeDisable}
159-
onClick={(e) => this.scrollTo(e, "before")}
160-
>
161-
before
162-
</button>
163-
<button
164-
disabled={this.state.nextDisable}
165-
onClick={(e) => this.scrollTo(e, "next")}>
166-
next
167-
</button>
175+
<FontAwesomeIcon color={(this.state.beforeDisable) ? '#777777' : this.props.color} style={iconsFontSize} icon={(this.props.rtl) ? faChevronRight : faChevronLeft} onClick={(e) => this.scrollTo(e, "before")} />
176+
<FontAwesomeIcon color={(this.state.nextDisable) ? '#777777' : this.props.color} style={iconsFontSize} icon={(this.props.rtl) ? faChevronLeft : faChevronRight} onClick={(e) => this.scrollTo(e, "next")} />
168177
</div>
169178
</div>
170179
</div>

0 commit comments

Comments
 (0)