diff --git a/packages/corewar-ui/src/features/common/featureButton.js b/packages/corewar-ui/src/features/common/featureButton.js index b0328853..71f50b15 100644 --- a/packages/corewar-ui/src/features/common/featureButton.js +++ b/packages/corewar-ui/src/features/common/featureButton.js @@ -1,27 +1,7 @@ -import styled from 'styled-components' +import React from 'react' -import { colour, space } from '../common/theme' - -const FeatureButton = styled.a` - border: 2px solid ${colour.white}; - border-radius: 5px; - margin: ${space.m}; - padding: ${space.m}; - background: none; - display: inline-block; - min-width: 200px; - color: ${colour.lightgrey}; - font-weight: 300; - text-align: center; - text-decoration: none; - transition: 0.2s; - - :hover { - background-color: ${colour.lightbg}; - color: ${colour.white}; - cursor: pointer; - transition: 0.2s; - } -` - -export default FeatureButton +export default ({ children }) => ( + +) diff --git a/packages/corewar-ui/src/features/common/heroLogo.js b/packages/corewar-ui/src/features/common/heroLogo.js index 29ba3241..12022d3a 100644 --- a/packages/corewar-ui/src/features/common/heroLogo.js +++ b/packages/corewar-ui/src/features/common/heroLogo.js @@ -26,7 +26,7 @@ const HeroLogo = () => (
{features.map(feature => ( - +

{feature.heading}

diff --git a/packages/corewar-ui/src/features/common/link.js b/packages/corewar-ui/src/features/common/link.js new file mode 100644 index 00000000..945e0ccb --- /dev/null +++ b/packages/corewar-ui/src/features/common/link.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default ({ route, children }) => ( + + {children} + +) diff --git a/packages/corewar-ui/src/features/common/mobileLink.js b/packages/corewar-ui/src/features/common/mobileLink.js new file mode 100644 index 00000000..4c7879e6 --- /dev/null +++ b/packages/corewar-ui/src/features/common/mobileLink.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default ({ route, children }) => ( + + {children} + +) diff --git a/packages/corewar-ui/src/features/common/primaryButton.js b/packages/corewar-ui/src/features/common/primaryButton.js new file mode 100644 index 00000000..d5aa6307 --- /dev/null +++ b/packages/corewar-ui/src/features/common/primaryButton.js @@ -0,0 +1,7 @@ +import React from 'react' + +export default ({ children }) => ( + +) diff --git a/packages/corewar-ui/src/features/common/siteNav.js b/packages/corewar-ui/src/features/common/siteNav.js index 9d3fb957..2188ac59 100644 --- a/packages/corewar-ui/src/features/common/siteNav.js +++ b/packages/corewar-ui/src/features/common/siteNav.js @@ -1,56 +1,51 @@ -import React from 'react' -import styled from 'styled-components' +import React, { useState } from 'react' -import { colour, space } from '../common/theme' -import { media } from '../common/mediaQuery' +import Logo from '../topbar/logo' +import Link from './link' +import MobileLink from './mobileLink' -const Header = styled.header` - display: flex; - flex-direction: row-reverse; - margin: 0 ${space.xl}; - ${media.phone`margin: 0;`} +const links = [ + { route: `/app/editor/src`, text: `play` }, + { route: `/learn`, text: `learn` }, + { route: `/#features`, text: `features` }, + { route: `/sign-up`, text: `sign up` }, + { route: `/contact-us`, text: `contact us` }, + { route: `https://github.com/corewar/corewar.io`, text: `code` } +] - a { - color: ${colour.grey}; - padding-bottom: ${space.s}; - margin: 0 ${space.s}; - ${media.phone`margin: 0;`} - display: inline-block; - min-width: 80px; - text-decoration: none; - font-weight: 400; - text-align: center; - border-bottom: 2px solid transparent; - transition: 0.5s; - } - - a:hover { - border-bottom: 2px solid ${colour.blue}; - colour: ${colour.white}; - transition: 0.5s; - } -` - -const Nav = styled.nav` - display: flex; - flex-direction: row; - justify-content: flex-end; - ${media.phone`justify-content: center;`} - align-items: center; - width: 100%; -` - -const SiteNav = () => ( -
- -
-) +const SiteNav = () => { + const [isExpanded, toggleExpansion] = useState(false) + return ( +
+
+ + + + +
+
+ ) +} export default SiteNav diff --git a/packages/corewar-ui/src/features/navbar/navbar.js b/packages/corewar-ui/src/features/navbar/navbar.js index 9f23b490..3766eced 100644 --- a/packages/corewar-ui/src/features/navbar/navbar.js +++ b/packages/corewar-ui/src/features/navbar/navbar.js @@ -1,14 +1,5 @@ import React from 'react' -import styled from 'styled-components' -import { space } from '../common/theme' -import TabLink from '../common/tabLink' - -const NavBarGrid = styled.div` - grid-row-start: 2; - margin-left: ${space.sidebar}; - display: flex; - text-align: center; -` +import TabLink from './tabLink' const navigationData = { EDITOR: [ @@ -24,15 +15,13 @@ const navigationData = { } const NavBar = ({ interfaceMode }) => ( - +
{navigationData[interfaceMode].map(link => ( {link.text} ))} - +
) -NavBarGrid.displayName = 'NavBarGrid' - export default NavBar diff --git a/packages/corewar-ui/src/features/common/tabLink.js b/packages/corewar-ui/src/features/navbar/tabLink.js similarity index 100% rename from packages/corewar-ui/src/features/common/tabLink.js rename to packages/corewar-ui/src/features/navbar/tabLink.js diff --git a/packages/corewar-ui/src/features/onboarding/feature.js b/packages/corewar-ui/src/features/onboarding/feature.js new file mode 100644 index 00000000..abe28b1c --- /dev/null +++ b/packages/corewar-ui/src/features/onboarding/feature.js @@ -0,0 +1,9 @@ +import React from 'react' + +export default ({ children, className }) => ( +
+ {children} +
+) diff --git a/packages/corewar-ui/src/features/onboarding/featureDescription.js b/packages/corewar-ui/src/features/onboarding/featureDescription.js new file mode 100644 index 00000000..4077d6d4 --- /dev/null +++ b/packages/corewar-ui/src/features/onboarding/featureDescription.js @@ -0,0 +1,7 @@ +import React from 'react' + +export default ({ children }) => ( +

+ {children} +

+) diff --git a/packages/corewar-ui/src/features/onboarding/guidance.js b/packages/corewar-ui/src/features/onboarding/guidance.js new file mode 100644 index 00000000..b4644558 --- /dev/null +++ b/packages/corewar-ui/src/features/onboarding/guidance.js @@ -0,0 +1,7 @@ +import React from 'react' + +export default ({ children }) => ( +
+ {children} +
+) diff --git a/packages/corewar-ui/src/features/onboarding/guidanceText.js b/packages/corewar-ui/src/features/onboarding/guidanceText.js new file mode 100644 index 00000000..b23cdd83 --- /dev/null +++ b/packages/corewar-ui/src/features/onboarding/guidanceText.js @@ -0,0 +1,11 @@ +import React from 'react' +import Octicon from 'react-octicon' + +import SpeechBubble from './speechBubble' + +export default ({ children }) => ( +
+ + {children} +
+) diff --git a/packages/corewar-ui/src/features/onboarding/home.js b/packages/corewar-ui/src/features/onboarding/home.js index 2eb59880..3d3da9bd 100644 --- a/packages/corewar-ui/src/features/onboarding/home.js +++ b/packages/corewar-ui/src/features/onboarding/home.js @@ -1,14 +1,15 @@ import React from 'react' -import styled from 'styled-components' import Octicon from 'react-octicon' -import { colour, font, space } from '../common/theme' -import { media } from '../common/mediaQuery' - import SiteNav from '../common/siteNav' import HeroLogo from '../common/heroLogo' import FeatureButton from '../common/featureButton' +import PrimaryButton from '../common/primaryButton' import RoadmapItem from './roadmapItem' +import Guidance from './guidance' +import GuidanceText from './guidanceText' +import Feature from './feature' +import FeatureDescription from './featureDescription' import SimulatorImage from '../../img/corewarx200.gif' import ParserImage from '../../img/redcode.gif' @@ -63,75 +64,26 @@ const roadMapItems = [ } ] -const Feature = styled.div` - ${media.tablet`border-right: none;`}; - ${media.tablet`border-bottom: 1px solid ${colour.lightbg}; padding-bottom: ${space.l};`}; - - :hover { - cursor: pointer; - .guidance { - opacity: 1; - transition: 0.5s; - } - } -` - -const Guidance = styled.div.attrs({ - className: 'guidance' -})` - opacity: 0; - ${media.tablet`opacity: 1;`} - transition: 0.5s; - display: flex; - flex-direction: row; - align-items: center; - justify-content: flex-start; - margin: ${space.l}; - ${media.phone`margin: ${space.m};`} -` - -const SpeechBubble = styled.div` - border-radius: 10px; - background-color: ${colour.defaultbg}; - min-height: 200px; - margin-right: ${space.l}; - padding: ${space.m}; - line-height: 1.5em; - text-align: center; - color: ${colour.white}; - font-family: ${font.code}; - display: flex; - flex-direction: column; - justify-content: center; -` - -const PrimaryButton = FeatureButton.extend` - background: ${colour.white}; - color: ${colour.darkbg}; - transition: 0.2s; - font-weight: bold; -` - const Home = () => ( -
+
-
+
Play Now Learn more
-

+

This is Corewar where players test their coding skills against each other, writing warriors which battle for control of the core. Do you have what it takes to become the King of the Hill?

-
-
+ + Our interactive Corewar Simulator provides the battle ground for your warriors. Play the game, inspect the core and debug your code from your web browser! -
+
( alt={`Animated core simulator example`} />
-
-
+ +
( alt={`Animated parser usage example`} />
-
+ Our powerful Redcode editor makes it easy to write warriors and through real-time code analysis improve the quality of your programs. The perfect canvas on which to craft your masterpiece. -
-
+ +
-
+

Experienced player

I’ve played corewar before and understand the instructions and concepts

Play Now - - - - You should head over to the app and follow the interactive guide to explore the features - - -
-
+ + Head over to the app and follow the interactive guide to explore the features + + +

New to the game

I’ve done some coding before but never played corewar

View Tutorial - - - - You should run through the tutorial to understand the basics of corewar first, then head - over the app to test what you've learned. - - -
+ + Run through the tutorial to understand the basics of corewar first, then head over the app + to test what you've learned. + +
( {roadMapItems .filter(x => x.complete) .map(item => ( - + ))}
@@ -208,7 +154,7 @@ const Home = () => ( {roadMapItems .filter(x => x.complete === false) .map(item => ( - + ))}
diff --git a/packages/corewar-ui/src/features/onboarding/roadmapItem.js b/packages/corewar-ui/src/features/onboarding/roadmapItem.js index 20bb1733..b9e1ec6a 100644 --- a/packages/corewar-ui/src/features/onboarding/roadmapItem.js +++ b/packages/corewar-ui/src/features/onboarding/roadmapItem.js @@ -3,13 +3,13 @@ import Octicon from 'react-octicon' export default ({ item }) => (
-
+
{item.leftText}
-
+
{item.rightText}
diff --git a/packages/corewar-ui/src/features/onboarding/speechBubble.js b/packages/corewar-ui/src/features/onboarding/speechBubble.js new file mode 100644 index 00000000..8a1112ed --- /dev/null +++ b/packages/corewar-ui/src/features/onboarding/speechBubble.js @@ -0,0 +1,7 @@ +import React from 'react' + +export default ({ children }) => ( +
+ {children} +
+) diff --git a/packages/corewar-ui/src/features/topbar/logo.js b/packages/corewar-ui/src/features/topbar/logo.js index 955d0ec3..1208412a 100644 --- a/packages/corewar-ui/src/features/topbar/logo.js +++ b/packages/corewar-ui/src/features/topbar/logo.js @@ -1,61 +1,21 @@ import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' - -import { colour, font, space } from '../common/theme' import CorewarLogo from '../../img/corewar-logo.png' -const Wrapper = styled.section` - display: grid; - grid-template-columns: ${space.header} 1fr; -` - -const LogoImage = styled.img` - margin: ${space.s}; - width: calc(${space.header} - ${space.ss} - ${space.s}); - height: calc(${space.header} - ${space.s} - ${space.s}); -` - -const SiteName = styled.div` - font-family: ${font.default}; - font-size: ${font.large}; - color: ${colour.blue}; - font-weight: 300; - line-height: 1.2em; - padding-left: ${space.m}; - padding-top: ${space.s}; - - :hover { - cursor: pointer; - } -` - -SiteName.displayName = 'SiteName' - -const SiteDomain = styled.span` - font-weight: 500; - color: ${colour.white}; -` - -const Logo = ({ siteName, siteDomain, history }) => ( - history.push(`/`)}> - - +const Logo = ({ siteName, siteDomain }) => ( + + corewar-logo +
{siteName} - {siteDomain} - - + {siteDomain} +
+
) Logo.propTypes = { - siteName: PropTypes.string.isRequired, - siteDomain: PropTypes.string.isRequired -} - -Logo.defaultProps = { - siteName: 'corewar', - siteDomain: '.io' + siteName: PropTypes.string, + siteDomain: PropTypes.string } export default Logo diff --git a/packages/corewar-ui/src/features/topbar/siteHeader.js b/packages/corewar-ui/src/features/topbar/siteHeader.js index 9ac53df3..0493022d 100644 --- a/packages/corewar-ui/src/features/topbar/siteHeader.js +++ b/packages/corewar-ui/src/features/topbar/siteHeader.js @@ -18,9 +18,9 @@ const Header = styled.header` `} ` -const SiteHeader = ({ isAuthenticated, history }) => ( +const SiteHeader = ({ isAuthenticated }) => (
- + {isAuthenticated ? : }
) diff --git a/packages/corewar-ui/src/styles/index.css b/packages/corewar-ui/src/styles/index.css index 7f393742..dd304dd2 100644 --- a/packages/corewar-ui/src/styles/index.css +++ b/packages/corewar-ui/src/styles/index.css @@ -2,4 +2,9 @@ @tailwind components; +.guidance:hover > section { + opacity: 1; + transition: 0.5s; +} + @tailwind utilities; diff --git a/packages/corewar-ui/src/styles/tailwind.css b/packages/corewar-ui/src/styles/tailwind.css index cfc4fa96..7f111643 100644 --- a/packages/corewar-ui/src/styles/tailwind.css +++ b/packages/corewar-ui/src/styles/tailwind.css @@ -615,6 +615,12 @@ video { } } +.guidance:hover > section { + opacity: 1; + -webkit-transition: 0.5s; + transition: 0.5s; +} + .sr-only { position: absolute; width: 1px; @@ -5331,6 +5337,18 @@ video { min-width: 0; } +.min-w-150 { + min-width: 150px; +} + +.min-w-200 { + min-width: 200px; +} + +.min-w-300 { + min-width: 300px; +} + .min-w-full { min-width: 100%; } @@ -10841,8 +10859,12 @@ video { grid-template-rows: none; } +.grid-rows-mobile-home-grid { + grid-template-rows: minmax(48px, 1fr) 25vh repeat(8, auto) 100px; +} + .grid-rows-home-grid { - grid-template-rows: 48px 50vh repeat(8, auto) 100px; + grid-template-rows: minmax(48px, 1fr) 50vh repeat(8, auto) 100px; } .grid-rows-roadmap { @@ -17445,6 +17467,18 @@ video { min-width: 0; } + .sm\:min-w-150 { + min-width: 150px; + } + + .sm\:min-w-200 { + min-width: 200px; + } + + .sm\:min-w-300 { + min-width: 300px; + } + .sm\:min-w-full { min-width: 100%; } @@ -22955,8 +22989,12 @@ video { grid-template-rows: none; } + .sm\:grid-rows-mobile-home-grid { + grid-template-rows: minmax(48px, 1fr) 25vh repeat(8, auto) 100px; + } + .sm\:grid-rows-home-grid { - grid-template-rows: 48px 50vh repeat(8, auto) 100px; + grid-template-rows: minmax(48px, 1fr) 50vh repeat(8, auto) 100px; } .sm\:grid-rows-roadmap { @@ -29560,6 +29598,18 @@ video { min-width: 0; } + .md\:min-w-150 { + min-width: 150px; + } + + .md\:min-w-200 { + min-width: 200px; + } + + .md\:min-w-300 { + min-width: 300px; + } + .md\:min-w-full { min-width: 100%; } @@ -35070,8 +35120,12 @@ video { grid-template-rows: none; } + .md\:grid-rows-mobile-home-grid { + grid-template-rows: minmax(48px, 1fr) 25vh repeat(8, auto) 100px; + } + .md\:grid-rows-home-grid { - grid-template-rows: 48px 50vh repeat(8, auto) 100px; + grid-template-rows: minmax(48px, 1fr) 50vh repeat(8, auto) 100px; } .md\:grid-rows-roadmap { @@ -41675,6 +41729,18 @@ video { min-width: 0; } + .lg\:min-w-150 { + min-width: 150px; + } + + .lg\:min-w-200 { + min-width: 200px; + } + + .lg\:min-w-300 { + min-width: 300px; + } + .lg\:min-w-full { min-width: 100%; } @@ -47185,8 +47251,12 @@ video { grid-template-rows: none; } + .lg\:grid-rows-mobile-home-grid { + grid-template-rows: minmax(48px, 1fr) 25vh repeat(8, auto) 100px; + } + .lg\:grid-rows-home-grid { - grid-template-rows: 48px 50vh repeat(8, auto) 100px; + grid-template-rows: minmax(48px, 1fr) 50vh repeat(8, auto) 100px; } .lg\:grid-rows-roadmap { @@ -53790,6 +53860,18 @@ video { min-width: 0; } + .xl\:min-w-150 { + min-width: 150px; + } + + .xl\:min-w-200 { + min-width: 200px; + } + + .xl\:min-w-300 { + min-width: 300px; + } + .xl\:min-w-full { min-width: 100%; } @@ -59300,8 +59382,12 @@ video { grid-template-rows: none; } + .xl\:grid-rows-mobile-home-grid { + grid-template-rows: minmax(48px, 1fr) 25vh repeat(8, auto) 100px; + } + .xl\:grid-rows-home-grid { - grid-template-rows: 48px 50vh repeat(8, auto) 100px; + grid-template-rows: minmax(48px, 1fr) 50vh repeat(8, auto) 100px; } .xl\:grid-rows-roadmap { diff --git a/packages/corewar-ui/tailwind.config.js b/packages/corewar-ui/tailwind.config.js index f6a590fb..15fa3457 100644 --- a/packages/corewar-ui/tailwind.config.js +++ b/packages/corewar-ui/tailwind.config.js @@ -22,7 +22,8 @@ module.exports = { success: '#6FCF97' }, gridTemplateRows: { - 'home-grid': '48px 50vh repeat(8, auto) 100px', + 'mobile-home-grid': 'minmax(48px, 1fr) 25vh repeat(8, auto) 100px', + 'home-grid': 'minmax(48px, 1fr) 50vh repeat(8, auto) 100px', roadmap: '80px 1fr' }, gridTemplateColumns: { @@ -33,6 +34,11 @@ module.exports = { '200': '200px', '300': '300px' }, + minWidth: { + '150': '150px', + '200': '200px', + '300': '300px' + }, maxWidth: { '350': '350px' },