From 65ca0ae07b33476f018b369d0f33852d645868c5 Mon Sep 17 00:00:00 2001 From: Brad Westfall Date: Fri, 22 Mar 2019 15:19:48 -0700 Subject: [PATCH 1/2] tour ad --- website/modules/base.css | 37 ++++ .../modules/components/EnvironmentHeader.js | 21 ++- .../modules/components/EnvironmentLarge.js | 3 + website/modules/components/FakeBrowser.js | 177 ------------------ website/modules/components/HooksTourAd.js | 19 ++ website/modules/components/NativeExample.js | 66 ------- website/modules/components/WebExample.js | 64 ------- 7 files changed, 79 insertions(+), 308 deletions(-) delete mode 100644 website/modules/components/FakeBrowser.js create mode 100644 website/modules/components/HooksTourAd.js delete mode 100644 website/modules/components/NativeExample.js delete mode 100644 website/modules/components/WebExample.js diff --git a/website/modules/base.css b/website/modules/base.css index 2c9e802e8f..a1adc98c83 100644 --- a/website/modules/base.css +++ b/website/modules/base.css @@ -258,3 +258,40 @@ h3 { opacity: 1; transition: opacity 250ms ease-in; } + +/* Just some temporary CSS for our hooks tour ad */ + +.hooks-tour { + padding: 1.5em; + background-image: url(https://reacttraining.com/images/blue-fade.svg), + url(https://reacttraining.com/images/blue-fade.svg); + background-position: 50% 0, 0 -20%; + background-size: 100%; + background-repeat: no-repeat; + background-color: #edf4f7; + border: 1px solid #d3dbde; + text-align: center; + border-radius: 0.5em; +} + +.hooks-tour .logo { + width: 60%; +} + +.hooks-tour a { + display: inline-block; + margin: 0.2em 0; + padding: 0.2em 0.5em; + background-color: #e94948; + color: #fff; + border-radius: 0.2em; +} + +.hooks-tour hr { + border: none; + border-bottom: 1px solid #d3dbde; +} + +.hooks-tour p:last-of-type { + font-size: 0.7em; +} diff --git a/website/modules/components/EnvironmentHeader.js b/website/modules/components/EnvironmentHeader.js index e418d5ccf6..eb11568d0d 100644 --- a/website/modules/components/EnvironmentHeader.js +++ b/website/modules/components/EnvironmentHeader.js @@ -2,8 +2,9 @@ import React from "react"; import { Link, Route } from "react-router-dom"; import { Block, Row, Inline, Col } from "jsxstyle"; import PropTypes from "prop-types"; +import Media from "react-media"; -import { LIGHT_GRAY, RED } from "../Theme"; +import { LIGHT_GRAY, RED, SMALL_SCREEN } from "../Theme"; import Logo from "./Logo"; function Tab({ to, ...rest }) { @@ -82,6 +83,24 @@ function Branding() { function EnvironmentHeader() { return ( + + +

+ + Attend a React Workshop + {" "} + in a city near you this Spring! +

+
+
diff --git a/website/modules/components/EnvironmentLarge.js b/website/modules/components/EnvironmentLarge.js index eb194bf5ba..ffc573ef1b 100644 --- a/website/modules/components/EnvironmentLarge.js +++ b/website/modules/components/EnvironmentLarge.js @@ -8,6 +8,7 @@ import EnvironmentHeader from "./EnvironmentHeader"; import Example from "./Example"; import Guide from "./Guide"; import API from "./API"; +import HooksTourAd from "./HooksTourAd"; class EnvironmentLarge extends Component { static propTypes = { @@ -98,6 +99,8 @@ NavLink.propTypes = { function NavLinks({ data, environment }) { return ( + + {Array.isArray(data.examples) && data.examples.length > 0 && ( diff --git a/website/modules/components/FakeBrowser.js b/website/modules/components/FakeBrowser.js deleted file mode 100644 index 16ef64a5d3..0000000000 --- a/website/modules/components/FakeBrowser.js +++ /dev/null @@ -1,177 +0,0 @@ -import React, { Component } from "react"; -import { MemoryRouter, Route } from "react-router-dom"; -import { Block, Col, Row } from "jsxstyle"; - -import { LIGHT_GRAY, GRAY } from "../Theme"; - -function LeftArrowIcon(props) { - return ( - - - - ); -} - -function RightArrowIcon(props) { - return ( - - - - ); -} - -function FileCodeIcon() { - return ( - - - - ); -} - -function Button({ children, ...props }) { - return ( - - ); -} - -function getUserConfirmation(message, callback) { - callback(window.confirm(message)); -} - -function createPath(location) { - return location.pathname + location.search; -} - -class FakeBrowser extends Component { - state = { url: null }; - - render() { - const { url } = this.state; - const { children, ...rest } = this.props; - - return ( - - ( - - - - - - - - - { - this.setState({ url: e.target.value }); - }, - onKeyDown: e => { - if (e.key === "Enter") { - this.setState({ url: null }); - history.push(e.target.value); - } - } - }} - /> - - - - {React.cloneElement(React.Children.only(children), { - location - })} - - - )} - /> - - ); - } -} - -export default FakeBrowser; diff --git a/website/modules/components/HooksTourAd.js b/website/modules/components/HooksTourAd.js new file mode 100644 index 0000000000..945c383710 --- /dev/null +++ b/website/modules/components/HooksTourAd.js @@ -0,0 +1,19 @@ +import React from "react"; + +function HooksTourAdd() { + return ( +
+ React Training Logo +

Attend a React Workshop in a city near you this Spring!

+ View Schedule +
+

By the creators of React Router

+
+ ); +} + +export default HooksTourAdd; diff --git a/website/modules/components/NativeExample.js b/website/modules/components/NativeExample.js deleted file mode 100644 index 7b5431e973..0000000000 --- a/website/modules/components/NativeExample.js +++ /dev/null @@ -1,66 +0,0 @@ -import React from "react"; -import Media from "react-media"; -import { Block, Col } from "jsxstyle"; -import PropTypes from "prop-types"; - -import Bundle from "./Bundle"; -import SourceViewer from "./SourceViewer"; -import SmallScreen from "./SmallScreen"; -import Loading from "./Loading"; - -function NativeExample({ example }) { - return ( - - {src => - src ? ( - - {largeScreen => ( - - {smallScreen => ( - - - {example.appetizeURL && ( -