React Button variants test
How do I make an react button variants test?
What is a react button variants test? How do you make a react button variants test? This script and codes were developed by Ajay Karwal on 08 January 2023, Sunday.
React Button variants test - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React Button variants test</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="app"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
React Button variants test - Script Codes CSS Codes
button { background: slategrey; color: white; display: inline-block; vertical-align: middle; border: 0; border-radius: 5px; padding: 10px 20px; cursor: pointer; margin: 0 5px; font-weight: 100;
}
button.primary { background: indianred;
}
button.secondary { background: olive;
}
button.large { font-size: 2em;
}
button[disabled] { background: silver; color: grey; cursor: not-allowed;
}
body { padding: 20px; text-align: center; margin: auto;
}
React Button variants test - 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 Button = function (_React$Component) { _inherits(Button, _React$Component); function Button(props) { _classCallCheck(this, Button); return _possibleConstructorReturn(this, _React$Component.call(this, props)); } Button.prototype.render = function render() { return React.createElement( "button", { className: this.props.variant, disabled: this.props.disabled }, this.props.text ); }; return Button;
}(React.Component);
Button.defaultProps = { text: "Click Me"
};
var Buttons = function (_React$Component2) { _inherits(Buttons, _React$Component2); function Buttons() { _classCallCheck(this, Buttons); return _possibleConstructorReturn(this, _React$Component2.apply(this, arguments)); } Buttons.prototype.render = function render() { return React.createElement( "div", null, React.createElement(Button, null), React.createElement(Button, { variant: "primary" }), React.createElement(Button, { variant: "secondary large", text: "I'm a big button" }), React.createElement(Button, { disabled: "true", text: "Can't click me!" }) ); }; return Buttons;
}(React.Component);
ReactDOM.render(React.createElement(Buttons, null), document.getElementById('app'));
Developer | Ajay Karwal |
Username | ajaykarwal |
Uploaded | January 08, 2023 |
Rating | 3 |
Size | 3,319 Kb |
Views | 6,072 |
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!
Name | Size |
CSS Grid Test | 2,377 Kb |
Background Color Switcher - ReactJS Component | 4,580 Kb |
ToDo List - Vanilla JS | 3,546 Kb |
Skill Bars - React Component | 4,637 Kb |
Custom animated checkboxes | 2,818 Kb |
Change Case | 2,299 Kb |
How to make the perfect diffused drop shadow | 2,868 Kb |
Pen Credit | 1,698 Kb |
Palindrome Checker | 2,246 Kb |
CSS Grid - Grid Template Areas | 2,314 Kb |
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!
Name | Username | Size |
Electric worm | Jeffibacache | 2,377 Kb |
Ghost | Mghayour | 11,738 Kb |
IE flex collapse bug fix | Rowno | 2,678 Kb |
A Pen by Jason Kinney | Jason-kinney | 1,980 Kb |
Playing with FlexBox | _Billy_Brown | 3,162 Kb |
Pagepilling.js | Blossk | 6,554 Kb |
Sencha Touch 2.3.1 Basic Grid Example | Trozdol | 2,770 Kb |
Svg animation draw | SzymonDziewonski | 5,545 Kb |
Mandelbrot Fractal | _Billy_Brown | 2,706 Kb |
Rain Landing in a Pond | Edball | 3,009 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!