React UI - 04 Steps Form

Size
4,906 Kb
Views
20,240

How do I make an react ui - 04 steps form?

What is a react ui - 04 steps form? How do you make a react ui - 04 steps form? This script and codes were developed by Xavier Martínez on 31 October 2022, Monday.

React UI - 04 Steps Form Previews

React UI - 04 Steps Form - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React UI - 04 Steps Form</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="container"></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 - 04 Steps Form - Script Codes CSS Codes

body { margin: 0; font-family: 'Arial', sans-serif;
}
.slide-header { display: flex; justify-content: space-between; padding: 30px; background-color: black;
}
.slide-header .slide-question { color: white;
}
.slide-header .slide-id { color: black; font-size: 40px; font-weight: bold; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center;
}
.slide-answer { display: flex; align-items: center; justify-content: space-around; padding: 30px; min-height: 60px; background-color: grey;
}
.slide-answer .input-text { height: 30px; border: none; background-color: lightgrey; padding: 5px;
}
.slide-answer a { cursor: pointer; border: 2px solid black; border-radius: 10px; background-color: white; padding: 10px;
}
.slider-footer { display: flex; align-items: center; background-color: black; padding: 30px;
}
.slider-footer .slider-info { color: white; width: 100%;
}
.slider-footer .slider-nav { display: flex; justify-content: space-between; padding: 10px; width: 250px; color: white; font-weight: bold;
}
.slider-footer .slider-nav a { cursor: pointer; background-color: grey; padding: 5px; border-radius: 10px; border: 2px solid white;
}

React UI - 04 Steps Form - 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 form = { steps: [{ id: 1, color: "yellow", question: "What's your name?", answer: "text", options: ["Yes", "No", "Maybe"], info: "If you need some help, call us at 5489584584" }, { id: 2, color: "orangered", question: "Do you like to party?", answer: "selection", options: ["Yes", "No", "Maybe"], info: ":D" }, { id: 3, color: "lightgreen", question: "Really?", answer: "selection", options: ["Of course", "I'm not sure", "o_O"], info: "It's fine!" }]
};
var NUM_SLIDES = form.steps.length;
var slidenum = 0;
var App = function (_React$Component) { _inherits(App, _React$Component); function App(props) { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { currentslide: form.steps[0] }; _this.navigateLeft = _this.navigateLeft.bind(_this); _this.navigateRight = _this.navigateRight.bind(_this); return _this; } App.prototype.navigateLeft = function navigateLeft() { if (slidenum > 0) { slidenum--; this.setState(function () { return { currentslide: form.steps[slidenum] }; }); } }; App.prototype.navigateRight = function navigateRight() { if (slidenum < NUM_SLIDES - 1) { slidenum++; this.setState({ currentslide: form.steps[slidenum] }); } }; App.prototype.render = function render() { return React.createElement( "div", null, React.createElement( "section", { className: "slide-header" }, React.createElement( "div", { className: "slide-question" }, React.createElement( "h1", null, this.state.currentslide.question ) ), React.createElement( "div", { className: "slide-id", style: { backgroundColor: this.state.currentslide.color } }, React.createElement( "p", null, this.state.currentslide.id ) ) ), React.createElement( "section", { className: "slide-answer" }, this.state.currentslide.answer === "text" && React.createElement("input", { type: "text", className: "input-text" }), this.state.currentslide.answer === "selection" && this.state.currentslide.options.map(function (option) { return React.createElement( "a", null, option ); }) ), React.createElement( "section", { className: "slider-footer" }, React.createElement( "div", { className: "slider-info" }, "INFO: ", this.state.currentslide.info ), React.createElement( "div", { className: "slider-nav" }, React.createElement( "a", { onClick: this.navigateLeft, style: this.state.currentslide.id === 1 ? { display: 'none' } : { display: 'flex' }, className: "nav-arrow left-arrow" }, "◀ PREVIOUS" ), React.createElement( "a", { onClick: this.navigateRight, className: "nav-arrow right-arrow" }, this.state.currentslide.id === NUM_SLIDES ? 'SUBMIT' : 'NEXT ▶' ) ) ) ); }; return App;
}(React.Component);
ReactDOM.render(React.createElement(App, null), document.getElementById('container'));
React UI - 04 Steps Form - Script Codes
React UI - 04 Steps Form - Script Codes
Home Page Home
Developer Xavier Martínez
Username xmjol
Uploaded October 31, 2022
Rating 3
Size 4,906 Kb
Views 20,240
Do you need developer help for React UI - 04 Steps Form?

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 marketing copy 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!