React Button variants test

Developer
Size
3,319 Kb
Views
6,072

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 Previews

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'));
React Button variants test - Script Codes
React Button variants test - Script Codes
Home Page Home
Developer Ajay Karwal
Username ajaykarwal
Uploaded January 08, 2023
Rating 3
Size 3,319 Kb
Views 6,072
Do you need developer help for React Button variants test?

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!

Ajay Karwal (ajaykarwal) Script Codes
Create amazing video scripts 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!