React UI - 01 - Voting System

Size
4,796 Kb
Views
36,432

How do I make an react ui - 01 - voting system?

What is a react ui - 01 - voting system? How do you make a react ui - 01 - voting system? This script and codes were developed by Xavier Martínez on 25 September 2022, Sunday.

React UI - 01 - Voting System Previews

React UI - 01 - Voting System - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React UI - 01 - Voting System</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/evil-icons/1.9.0/evil-icons.min.css">
<script src="https://cdn.jsdelivr.net/evil-icons/1.9.0/evil-icons.min.js"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>React Voting System</h1>
<div id="app"></div> <script src='https://npmcdn.com/[email protected]/dist/react.min.js'></script>
<script src='https://npmcdn.com/[email protected]/dist/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

React UI - 01 - Voting System - Script Codes CSS Codes

@import url("https://fonts.googleapis.com/css?family=Kalam");
body { margin: 0; background-color: #E3F2FD;
}
h1 { font-family: "Kalam", sans-serif; text-align: center; color: #673AB7; font-size: 32px;
}
.counter-list { margin: 60px; display: flex; flex-flow: row wrap; align-items: center; justify-content: space-around;
}
.counter-item { border: 2px solid black; flex: 1; display: flex; align-items: center; background-color: #EEEEEE; text-align: center; flex-flow: column nowrap; max-width: 200px; margin: 20px; padding: 10px;
}
.counter-item .counter-item-name { color: #673AB7; font-family: "Kalam", sans-serif; font-size: 36px; margin: 0px;
}
.counter-item .icon--ei-user { background-color: white; border: 2px solid black; border-bottom: none; fill: #673AB7; width: 110px; height: 80px; margin-top: 0;
}
.counter-item .counter-item-votes { display: flex; justify-content: center; align-items: center; width: 100px; color: #FFEB3B; background-color: #673AB7; border: 2px solid black; border-top: none; margin: 0px; padding: 5px; font-family: "Kalam", sans-serif; font-weight: bold; font-size: 20px;
}
.counter-item .counter-item-votes .icon { position: initial !important; display: flex !important; width: 24px; height: 25px !important; padding-left: 5px;
}
.button-list { margin: 10px; display: flex; flex-flow: row wrap; justify-content: space-around; width: 150px;
}
button { border: 2px solid black; padding: 5px; width: 40px; cursor: pointer; color: black; font-family: "Kalam", sans-serif; font-size: 16px; font-weight: bold; outline: 0;
}
button.add { background-color: green;
}
button.minus { background-color: red;
}

React UI - 01 - Voting System - Script Codes JS Codes

"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var data = { "counters": [{ "name": "Bob", "votes": 3 }, { "name": "Cole", "votes": 10 }, { "name": "Mary", "votes": 5 }, { "name": "Sarah", "votes": 12 }]
};
function CounterList(props) { return React.createElement( "div", { className: "counter-list" }, props.model_counter.map(function (counters) { return React.createElement(Counter, { name: counters.name, votes: counters.votes }); }) );
}
var Counter = function (_React$Component) { _inherits(Counter, _React$Component); function Counter(props) { _classCallCheck(this, Counter); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { count: props.votes }; _this.decreaseCount = _this.decreaseCount.bind(_this); _this.increaseCount = _this.increaseCount.bind(_this); return _this; } Counter.prototype.decreaseCount = function decreaseCount() { var _this2 = this; this.setState(function () { return { count: _this2.state.count === 0 ? 0 : _this2.state.count - 1 }; }); }; Counter.prototype.increaseCount = function increaseCount() { var _this3 = this; this.setState(function () { return { count: _this3.state.count + 1 }; }); }; Counter.prototype.render = function render() { return React.createElement( "div", { className: "counter-item" }, React.createElement( "p", { className: "counter-item-name" }, this.props.name ), React.createElement("i", { "data-icon": "ei-user", "data-size": "l" }), React.createElement( "p", { className: "counter-item-votes", style: this.state.count > 10 ? { color: 'lightgreen' } : null }, this.state.count, React.createElement("i", { "data-icon": "ei-like", "data-size": "s" }) ), React.createElement( "div", { className: "button-list" }, React.createElement( "button", { className: "minus", onClick: this.decreaseCount }, "-" ), React.createElement( "button", { className: "add", onClick: this.increaseCount }, "+" ) ) ); }; return Counter;
}(React.Component);
ReactDOM.render(React.createElement(CounterList, { model_counter: data.counters }), document.getElementById('app'));
React UI - 01 - Voting System - Script Codes
React UI - 01 - Voting System - Script Codes
Home Page Home
Developer Xavier Martínez
Username xmjol
Uploaded September 25, 2022
Rating 3
Size 4,796 Kb
Views 36,432
Do you need developer help for React UI - 01 - Voting System?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Xavier Martínez (xmjol) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!