"layout"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html lang='en' class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/Moroshan/pen/JWoJwB?limit=all&page=56&q=nav+tabs" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet"> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'> <style class="cp-pen-styles">body { font-family: 'Slabo 27px', serif; } .top-bar { background-color: #0f869c; color: #fff; } nav a { color: white; } .nav-tabs > li.active > a { color: #0f869c; background-color: #ffffff; } .secondary-text { font-style: italic; } .flex-parent { display: flex; } .flex-parent div { align-self: center; } .list-item { padding: 15px 0; } .list-item a { color: #484848; transition: all 0.3s; padding: 15px 0; font-size: 1em; } .list-item a:hover { transform: scale(1.1); text-decoration: none; color: lightgray; transition: all 0.3s; } h1 { font-size: 2em; } .avatar-box { position: relative; max-width: 65px; height: auto; margin: 0 auto; } .avatar-box .badge { position: absolute; top: 0; left: 0; background-color: #0f869c; opacity: 0.7; font-size: 1em; } @media screen and (min-width: 768px) { .badge, .username, .nav a { font-size: 1.3em; } h1 { font-size: 3em; } } </style></head><body> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://unpkg.com/react@15/dist/react.js'></script><script src='https://unpkg.com/react-dom@15/dist/react-dom.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js'></script><script src='https://unpkg.com/axios/dist/axios.min.js'></script> <script >"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 Main = function (_React$Component) { _inherits(Main, _React$Component); function Main() { _classCallCheck(this, Main); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Main.prototype.render = function render() { return React.createElement( "div", { className: "container-fluid" }, React.createElement( "div", { className: "row top-bar" }, React.createElement( "h1", { className: "text-center" }, "Free Code Camp Leaders" ), React.createElement( "div", { className: "col xs-12 col-sm-10 col-sm-offset-1 col-md-offset-2" }, React.createElement( "nav", { className: "row" }, React.createElement( "ul", { className: "nav nav-tabs col-xs-8 col-xs-offset-3 col-sm-8 col-sm-offset-4 col-md-6 col-md-offset-3", role: "tablist" }, React.createElement( "li", { className: "nav-item active" }, React.createElement( "a", { className: "nav-link", href: "#recent", role: "tab", "data-toggle": "tab" }, "Last 30 days" ) ), React.createElement( "li", { className: "nav-item" }, React.createElement( "a", { className: "nav-link", href: "#alltime", role: "tab", "data-toggle": "tab" }, "All times" ) ) ) ) ) ), React.createElement( "div", { className: "row" }, React.createElement( "div", { className: "tab-content col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2" }, React.createElement(JSONdata, { id: "recent", cl: "tab-pane active" }), React.createElement(JSONdata, { id: "alltime", cl: "tab-pane" }) ) ) ); }; return Main; }(React.Component); var JSONdata = function (_React$Component2) { _inherits(JSONdata, _React$Component2); function JSONdata(props) { _classCallCheck(this, JSONdata); var _this2 = _possibleConstructorReturn(this, _React$Component2.call(this, props)); _this2.state = { results: "" }; return _this2; } JSONdata.prototype.componentDidMount = function componentDidMount() { var _this3 = this; var that = this; $.getJSON('https://fcctop100.herokuapp.com/api/fccusers/top/' + this.props.id, function (data) { var results = []; for (var i = 0; i < data.length; i++) {if (window.CP.shouldStopExecution(1)){break;} var link = "https://www.freecodecamp.com/" + data[i].username; results.push(React.createElement( "a", { key: i, href: link, target: "_blank", className: "flex-parent col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2" }, React.createElement( "div", { className: "col-xs-3" }, React.createElement( "div", { className: "avatar-box" }, React.createElement("img", { className: "img-responsive img-circle", alt: "user's avatar", src: data[i].img }), React.createElement( "span", { className: "badge" }, i + 1 ) ) ), React.createElement( "div", { className: "col-xs-5 col-sm-6" }, React.createElement( "div", { className: "username" }, data[i].username ), React.createElement( "div", { className: "secondary-text" }, _this3.props.id === "recent" ? 'Total ' + data[i].alltime : '30 days: ' + data[i].recent, " points" ) ), React.createElement( "div", { className: "col-xs-4 col-sm-3" }, React.createElement( "span", { className: "badge" }, _this3.props.id === "recent" ? data[i].recent : data[i].alltime, " points" ) ) )); } window.CP.exitedLoop(1); that.setState({ results: results }); }); }; JSONdata.prototype.render = function render() { return React.createElement( "div", { role: "tabpanel", className: "tab-pane fade", className: this.props.cl, id: this.props.id }, React.createElement( "div", { className: "row list-item" }, this.state.results ) ); }; return JSONdata; }(React.Component); ReactDOM.render(React.createElement(Main, null), document.body); /* https://github.com/mzabriskie/axios */ //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: