diff --git a/content/download/platforms/linux.json b/content/download/platforms/linux.json new file mode 100644 index 000000000..a93247455 --- /dev/null +++ b/content/download/platforms/linux.json @@ -0,0 +1,5 @@ +{ + "title": "Linux", + "userAgent": "X11", + "sort": 2 +} \ No newline at end of file diff --git a/content/download/platforms/macos.json b/content/download/platforms/macos.json new file mode 100644 index 000000000..09c92ba9e --- /dev/null +++ b/content/download/platforms/macos.json @@ -0,0 +1,5 @@ +{ + "title": "macOS", + "userAgent": "Mac", + "sort": 1 +} \ No newline at end of file diff --git a/content/download/platforms/raspberry-pi.json b/content/download/platforms/raspberry-pi.json new file mode 100644 index 000000000..861e7d3e4 --- /dev/null +++ b/content/download/platforms/raspberry-pi.json @@ -0,0 +1,5 @@ +{ + "title": "Raspberry Pi", + "sort": 3, + "assets": "linux" +} \ No newline at end of file diff --git a/content/download/platforms/windows.json b/content/download/platforms/windows.json new file mode 100644 index 000000000..8bbf35f33 --- /dev/null +++ b/content/download/platforms/windows.json @@ -0,0 +1,5 @@ +{ + "title": "Windows", + "userAgent": "Windows", + "sort": 0 +} \ No newline at end of file diff --git a/gatsby-node.js b/gatsby-node.js index cb2226fab..1a200a2ad 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -374,6 +374,19 @@ async function createDownloadAndReleases(actions, graphql) { selectedPreReleases } } + platforms: allFile( + filter: { + sourceInstanceName: { eq: "download" } + relativeDirectory: { eq: "platforms" } + } + ) { + nodes { + name + childJson { + title + } + } + } } ` ); @@ -392,6 +405,17 @@ async function createDownloadAndReleases(actions, graphql) { selectedPreReleases } }); + for (const platform of result.data.platforms.nodes) { + createPage({ + path: `/download/${platform.name}`, + component: downloadTemplate, + context: { + selectedReleases, + selectedPreReleases, + os: platform.childJson.title + } + }); + } createPage({ path: '/releases', component: releasesTemplate, diff --git a/i18n/react-intl/en.json b/i18n/react-intl/en.json index 4389212d2..4a83003ab 100644 --- a/i18n/react-intl/en.json +++ b/i18n/react-intl/en.json @@ -157,6 +157,10 @@ "donateCryptoInfo": "To donate using crypto, DAF, or stocks, visit our Every.org donation page instead.", "donateButton": "Donate", "donateHelp": "Help us continue with your generosity!", + "windows": "Windows", + "macos": "macOS", + "linux": "Linux", + "raspberry-pi": "Raspberry Pi", "moreExamples": "More Examples", "referenceTitle": "Reference", "Topic Examples": "Topic Examples", diff --git a/src/components/Button.module.css b/src/components/Button.module.css index 95c2e4717..1704917c2 100644 --- a/src/components/Button.module.css +++ b/src/components/Button.module.css @@ -9,6 +9,15 @@ outline: none; border: none; cursor: pointer; + display: inline-flex; + justify-content: center; + gap: var(--gutter-half); + align-items: center; + svg{ + width: 1.5em; + height: 1.5em; + align-self: center; + } } .root:focus { @@ -21,42 +30,65 @@ } /* Variant: Animate1 & Animate2 */ +.dark { + background-color: var(--white); + color: var(--processing-blue-dark); +} +.outline{ + background-color: transparent; + color: var(--white); + border: 2px solid var(--white); +} .animate1, -.animate2 { +.animate2, +.dark, +.outline { position: relative; + &:before{ + content: ""; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + transition: all 0.3s; + z-index: -1; + background-color: var(--processing-blue-light); + transform: translate(-3px, 3px); + } + &:hover::before { + transform: translate(3px, -3px); + } + &.large::before { + transform: translate(-5px, 5px); + } + &.large:hover::before { + transform: translate(5px, -5px); + } } - -.animate1::before, -.animate2::before, -.animate2::after { - content: ""; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - transition: transform 0.3s; - z-index: -1; - background-color: var(--processing-blue-light); - transform: translate(-3px, 3px); +.dark::before{ + background-color: var(--white); + opacity: 0.25; } - -.animate1:hover::before, -.animate2:hover::before { - transform: translate(3px, -3px); - color: white; +.dark:hover{ + color: var(--processing-blue-dark); } - -.animate1.large::before, -.animate2.large::before { - transform: translate(-5px, 5px); +.dark:focus{ + background-color: var(--white); + color: var(--processing-blue-dark); } - -.animate1.large:hover::before, -.animate2.large:hover::before { - transform: translate(5px, -5px); +.outline::before{ + background: none; + border: 2px solid var(--white); + clip-path: inset(4px 4px 0px 0px); } +.outline:hover::before{ + background: none; + border: 2px solid var(--white); + clip-path: inset(0px 0px 4px 4px); +} + /* Variant: Animate2 */ @@ -70,14 +102,6 @@ color: white; } -.animate2.large::after { - transform: translate(5px, -5px); -} - -.animate2.large:hover::after { - transform: translate(-5px, 5px); -} - /* Variant: Gray */ .gray { diff --git a/src/components/Header.module.css b/src/components/Header.module.css index e3aac7c58..892eaf595 100644 --- a/src/components/Header.module.css +++ b/src/components/Header.module.css @@ -8,13 +8,4 @@ .root h1 { margin: 0; -} - -.root a { - color: inherit; - text-decoration: none; - - &:focus { - color: var(--processing-blue-dark); - } } \ No newline at end of file diff --git a/src/components/Navbar.js b/src/components/Navbar.js index a1db20320..184b4cd1f 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,10 +1,9 @@ -import React, { useMemo, useState, useEffect } from 'react'; +import React, { useState } from 'react'; import classnames from 'classnames'; -import { useLocation } from '@reach/router'; -import { LocalizedLink as Link, useLocalization } from 'gatsby-theme-i18n'; -import { useIntl } from 'react-intl'; +import { LocalizedLink as Link } from 'gatsby-theme-i18n'; import SearchBar from './SearchBar'; +import { NavbarItems } from './NavbarItems'; import * as css from './Navbar.module.css'; import * as grid from '../styles/grid.module.css'; @@ -13,101 +12,16 @@ import LogoProcessing from '../images/logo-processing.svg'; import CloseIcon from '../images/close-icon.svg'; import MenuIcon from '../images/menu-icon.svg'; -//the name values are used to get the value from the intl files -//it is not the name that is displayed -export const items = [ - { - name: 'home', - href: '/' - }, - { - name: 'download', - href: '/download' - }, - { - name: 'documentation', - children: [ - { name: 'reference', href: '/reference' }, - { name: 'environment', href: '/environment' }, - { name: 'libraries', href: '/reference/libraries' }, - { name: 'tools', href: '/reference/tools' }, - { name: 'wiki', href: 'https://wiki.processing.org' } - ] - }, - { - name: 'learn', - children: [ - { name: 'tutorials', href: '/tutorials' }, - { name: 'examples', href: '/examples' }, - { name: 'books', href: '/books' } - ] - }, - { - name: 'forum', - href: 'https://discourse.processing.org' - }, - { - name: 'about', - children: [ - { name: 'overview', href: '/overview' }, - { name: 'people', href: '/people' }, - { name: 'privacy', href: '/privacy' } - ] - }, - { - name: 'donate', - href: '/donate' - } -]; - const Navbar = ({ siteTitle, scrolled }) => { - const location = useLocation(); - const intl = useIntl(); - const [showSubmenu, setShowSubmenu] = useState(null); - const { locale } = useLocalization(); const [expanded, setExpanded] = useState(false); - - const current = useMemo(() => { - const removeIndex = location.pathname.indexOf('/', 1); - const currentLocation = - locale === 'en' - ? location.pathname - : location.pathname.slice(removeIndex); - for (var i = 0; i < items.length; i++) { - const item = items[i]; - if (item.href === currentLocation) { - return item.name; - } else if ( - item.children && - item.children.some((child) => child.href === currentLocation) - ) { - return item.name; - } - } - }, [location, locale]); - - const onClick = (name) => { - setShowSubmenu(name); - }; - - useEffect(() => { - const onMouseDown = (e) => { - if (e.target.nodeName.toLowerCase() !== 'button') { - setShowSubmenu(null); - } - }; - document.addEventListener('mousedown', onMouseDown); - return () => { - document.removeEventListener('mousedown', onMouseDown); - }; - }, []); - return (

@@ -125,60 +39,11 @@ const Navbar = ({ siteTitle, scrolled }) => { {expanded ? : }
    - {items.map((item, key) => ( -
  • - {item.href ? ( - item.href.startsWith('https') ? ( - - {intl.formatMessage({ id: item.name })} - - ) : ( - - {intl.formatMessage({ id: item.name })} - - ) - ) : ( - - )} - {item.children && ( -
      - {item.children.map((subitem, j) => ( -
    • - {subitem.href ? ( - subitem.href.startsWith('https') ? ( - - {intl.formatMessage({ id: subitem.name })} - - ) : ( - - {intl.formatMessage({ id: subitem.name })} - - ) - ) : ( - intl.formatMessage({ id: subitem.name }) - )} -
    • - ))} -
    - )} -
  • - ))} +

diff --git a/src/components/Navbar.module.css b/src/components/Navbar.module.css index 0e5518648..d8c1982a7 100644 --- a/src/components/Navbar.module.css +++ b/src/components/Navbar.module.css @@ -11,12 +11,14 @@ padding-bottom: calc(var(--gutter) / 2); box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); } + .container { height: 100%; align-items: center; flex-wrap: nowrap; justify-content: space-between; } + .logo { flex-basis: var(--col1); white-space: nowrap; @@ -24,6 +26,7 @@ font-size: 1.55rem; transform: translateY(10px); transition: 0.15s ease-in-out; + & svg { margin-bottom: -20px; width: 68px; @@ -38,6 +41,7 @@ .root.scrolled .logo { font-size: var(--text-large); transform: translateY(5px); + & svg { margin-bottom: -10px; } @@ -48,104 +52,24 @@ padding: 0; cursor: pointer; } + .spacer { - flex-grow: 4; + flex-grow: 3; } + .searchBar { min-width: 225px; flex-grow: 1; } + .menuWrapper { flex-grow: 2; } + .menu { display: flex; - list-style: none; justify-content: space-between; -} - -.item:first-child { - display: none; -} - -.item { - position: relative; - display: inline-block; - border-left: solid 4px transparent; - color: var(--processing-blue-dark); - font-size: var(--text-medium); - font-weight: 600; - white-space: nowrap; - & button, - & a { - padding: 0 0.75rem; - - display: block; - font-weight: inherit; - line-height: 1.5; - color: var(--processing-blue-dark); - } - & a:hover { - color: var(--processing-blue-mid); - } -} - -.item:hover { - z-index: 40; - border-left: solid 4px var(--processing-blue-mid); -} - -.active { - border-left: solid 4px var(--processing-blue-dark); -} -.item.hasSubmenu:hover { - border-left: solid 4px var(--processing-blue-dark); -} -.submenu { - display: flex; - position: absolute; - left: -4px; - top: 27px; - z-index: 30; - opacity: 0; - overflow: hidden; - max-height: 0; - padding-top: 16px; - list-style: none; - background-color: white; - border-bottom: 1px solid var(--lightgray); - box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); -} - -.subitem { - display: block; - margin-right: 0.5rem; - - border-left: solid 4px transparent; - color: var(--processing-blue-dark); - font-size: var(--text-regular); - font-weight: 700; - word-break: keep-all; - & a { - display: block; - padding: 3px 0.75rem; - } -} - -.subitem:hover { - border-left: solid 4px var(--processing-blue-mid); - color: var(--processing-blue-mid); - - & a:hover { - color: inherit; - } -} - -.item:hover .submenu, -.item:focus-visible .submenu, -.submenu:focus-within { - opacity: 1; - max-height: 400px; + align-items: baseline; } @media (--medium) { @@ -164,25 +88,16 @@ align-self: center; } } + .root.scrolled .logo { transform: translateY(4px); font-size: 1.15rem; } + .menuWrapper { padding-left: 0; padding-right: 0; } - .submenu { - top: 24px; - } - .item, - .subitem { - font-size: var(--text-normal); - & a, - & button { - padding: 0 0.55rem; - } - } } @media (--reduced) { @@ -195,14 +110,14 @@ flex-wrap: nowrap; max-height: 50px; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); - } - .root.expanded { - max-height: none; - } + &.expanded { + max-height: none; + } - .root.scrolled { - box-shadow: none; + &.scrolled { + box-shadow: none; + } } .logo { @@ -229,98 +144,44 @@ z-index: -1; height: 0; transition: opacity 0.1s ease-in-out; - } - .item { - margin-left: 0; - padding-left: 0.5rem; - } - .menu.expanded { - display: block; - height: calc(100vh - 90px); - flex-wrap: nowrap; - position: absolute; - z-index: 200; - opacity: 1; - - max-width: 100%; - width: 100%; - background-color: white; - overflow: scroll; - padding-bottom: 20px; - - & > .item { + &.expanded { display: block; - } + height: calc(100vh - 90px); + flex-wrap: nowrap; + position: absolute; + z-index: 200; + opacity: 1; + + max-width: 100%; + width: 100%; + background-color: white; + overflow: scroll; + padding-bottom: 20px; - & > .subitem { - display: block; } } .root.scrolled .menu.expanded { height: calc(100vh - 36px); } + .menuToggle { display: block; transition: margin-top 0.15s ease-in-out; } + .expanded .menuToggle { margin-top: -40px; } + .expanded.scrolled .menuToggle { margin-top: 0px; } - - .item { - display: block; - font-size: var(--text-xlarge); - margin-top: 8px; - - & > a { - transition: padding-left 0.15s ease; - } - &:hover > a { - padding-left: 8px; - } - } - - .hasSubmenu { - padding-bottom: 0px; - } - .hasSubmenu:hover { - border-left: solid 4px var(--gray); - } - - .submenu { - overflow: visible; - position: relative; - flex-direction: column; - opacity: 1; - top: auto; - max-height: none; - padding: 0; - box-shadow: none; - border-bottom: none; - } - - .subitem { - margin-left: -8px; - padding-left: 24px; - transition: padding-left 0.15s ease; - display: block; - border-left: solid 4px transparent; - font-size: var(--text-large); - padding-bottom: 6px; - &:hover { - padding-left: 32px; - border-left: solid 4px var(--processing-blue-mid); - } - } } @media (--small) { .menu { padding-left: 24px; } -} +} \ No newline at end of file diff --git a/src/components/NavbarItems.js b/src/components/NavbarItems.js new file mode 100644 index 000000000..1a9afe913 --- /dev/null +++ b/src/components/NavbarItems.js @@ -0,0 +1,125 @@ +import React, { createContext, useContext } from 'react'; +import classnames from 'classnames'; +import { useLocation } from '@reach/router'; +import { LocalizedLink as Link } from 'gatsby-theme-i18n'; +import { useIntl } from 'react-intl'; + +import * as css from './NavbarItems.module.css'; + +//the name values are used to get the value from the intl files +//it is not the name that is displayed +export const items = [ + { + name: 'download', + href: '/download', + hideChildren: true, + children: [ + { name: 'windows', href: '/download/windows' }, + { name: 'macos', href: '/download/macos' }, + { name: 'linux', href: '/download/linux' }, + { name: 'raspberry-pi', href: '/download/raspberry-pi' } + ] + }, + { + name: 'documentation', + children: [ + { name: 'reference', href: '/reference' }, + { name: 'environment', href: '/environment' }, + { name: 'libraries', href: '/reference/libraries' }, + { name: 'tools', href: '/reference/tools' }, + { name: 'wiki', href: 'https://wiki.processing.org' } + ] + }, + { + name: 'learn', + children: [ + { name: 'tutorials', href: '/tutorials' }, + { name: 'examples', href: '/examples' }, + { name: 'books', href: '/books' } + ] + }, + { + name: 'forum', + href: 'https://discourse.processing.org' + }, + { + name: 'about', + children: [ + { name: 'overview', href: '/overview' }, + { name: 'people', href: '/people' }, + { name: 'privacy', href: '/privacy' } + ] + }, + { + name: 'donate', + href: '/donate', + class: css.donate, + icon() { + return ( + + + + ) + } + } +]; + +const NavbarItemContext = createContext(); + +export function NavbarItems() { + return items.map((item, key) => ( + + + + )) +} + +function NavbarElement({ className }) { + const intl = useIntl(); + const { href, name, children, hideChildren, class: clazz, icon } = useContext(NavbarItemContext); + const location = useLocation(); + const isCurrent = location.pathname === href; + const isCurrentCategory = children?.some(child => location.pathname === child.href); + + const classes = classnames({ + [css.item]: true, + [css.hasSubmenu]: children && !hideChildren, + [css.active]: isCurrent || isCurrentCategory, + [clazz]: true, + }, className) + + if (!href) { + return ( +
+ {intl.formatMessage({ id: name })} + +
+ ) + } + + return ( + + {icon && icon()} + {intl.formatMessage({ id: name })} + + + ) +} + +function NavbarItemChildren() { + const { children, hideChildren } = useContext(NavbarItemContext); + + if (!children || hideChildren) { + return null; + } + + return ( +
    + {children.map((subitem) => ( + + + + ))} +
+ ) +} diff --git a/src/components/NavbarItems.module.css b/src/components/NavbarItems.module.css new file mode 100644 index 000000000..b0c5678e0 --- /dev/null +++ b/src/components/NavbarItems.module.css @@ -0,0 +1,193 @@ +.item { + position: relative; + display: inline-flex; + align-items: baseline; + border-left: solid 4px transparent; + color: var(--processing-blue-dark); + font-size: var(--text-medium); + font-weight: 600; + white-space: nowrap; + + padding: 0 0.75rem; + + line-height: 1.5; + + border-left: solid 4px transparent; + transition: border-left-color 0.15s ease-in-out, color 0.15s ease-in-out; + + &:hover { + color: var(--processing-blue-mid); + border-left-color: var(--processing-blue-mid); + } + + &:not([href]) { + cursor: default; + color: var(--processing-blue-dark); + } +} + +.active, +.subitem.active, +.item.hasSubmenu:hover { + border-left-color: var(--processing-blue-dark); +} + +.submenu { + display: flex; + position: absolute; + left: 0; + top: 100%; + + opacity: 0; + overflow: hidden; + max-width: 0; + list-style: none; + + background-color: white; + border-bottom: 1px solid var(--lightgray); + box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); + + transition: max-width 0.15s ease-in-out, opacity 0.15s ease-in-out; +} + +.item:hover .submenu { + max-width: none; + opacity: 1; +} + +.subitem { + display: block; + margin-right: 0.5rem; + + border-left: solid 4px transparent; + color: var(--processing-blue-dark); + font-size: var(--text-regular); + font-weight: 700; + word-break: keep-all; + + transition: border-left-color 0.15s ease-in-out, color 0.15s ease-in-out; + + margin-top: 16px; + padding: var(--gutter-half) var(--gutter); + + &:hover { + border-left-color: var(--processing-blue-mid); + color: var(--processing-blue-mid); + } +} + + +.item:hover .submenu, +.item:focus-visible .submenu, +.submenu:focus-within { + opacity: 1; + max-height: 400px; +} + + +.donate { + background-color: var(--donate-bg-start); + background-image: linear-gradient(0deg, var(--donate-bg-start), var(--donate-bg-end)); + box-shadow: -3px 3px 0 var(--donate-shadow); + position: relative; + z-index: 0; + + transition: all 0.15s ease-in-out; + + padding: var(--gutter-half) var(--gutter); + + color: var(--white); + + border: 0; + justify-content: center; + /* align-items: center; */ + + gap: var(--gutter-half); + + svg { + width: 1.1em; + height: 1.1em; + transform: translateY(0.125em); + margin-left: 0; + } + + + &:hover { + border: 0; + box-shadow: 3px -3px 0 var(--donate-shadow); + color: var(--white); + } +} + +@media (--medium) { + .submenu { + top: 24px; + } + + .item, + .subitem { + font-size: var(--text-normal); + + & a, + & button { + padding: 0 0.55rem; + } + } +} + +@media (--reduced) { + .item { + margin-left: 0; + padding-left: 0.5rem; + } + + .item { + display: block; + font-size: var(--text-xlarge); + margin-top: 8px; + transition: padding-left 0.15s ease; + + &:hover { + padding-left: 8px; + } + } + + .hasSubmenu { + padding-bottom: 0px; + } + + .hasSubmenu:hover { + border-left: solid 4px var(--gray); + } + + .submenu { + overflow: visible; + position: relative; + flex-direction: column; + opacity: 1; + top: auto; + max-height: none; + padding: 0; + box-shadow: none; + border-bottom: none; + } + + .subitem { + margin-left: -8px; + padding-left: 24px; + transition: padding-left 0.15s ease; + display: block; + border-left: solid 4px transparent; + font-size: var(--text-large); + padding-bottom: 6px; + + &:hover { + padding-left: 32px; + border-left: solid 4px var(--processing-blue-mid); + } + } + + .donate { + display: inline-flex; + } +} \ No newline at end of file diff --git a/src/components/download/DownloadCTA.js b/src/components/download/DownloadCTA.js new file mode 100644 index 000000000..d84503ad2 --- /dev/null +++ b/src/components/download/DownloadCTA.js @@ -0,0 +1,58 @@ +import React from "react"; +import classnames from 'classnames' +import * as grid from '../../styles/grid.module.css'; +import * as styles from './DownloadCTA.module.css'; +import { StaticImage } from "gatsby-plugin-image" +import Button from '../Button'; +import { Link } from 'gatsby'; +import { PlatformIcon, useGuessedPlatform, usePlatforms } from './Platform'; + + +export default function DownloadCTA() { + const { selected } = useGuessedPlatform(); + const platforms = usePlatforms(); + + return ( +
+
+

+ Welcome to Processing +

+

+ Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, it's been where artists, designers, researchers, and learners go to bring ideas to life with code. +

+
+
+ + +
+
+

Runs on

+
    + {platforms.map(node => ( +
  • + + + +
  • + ))} +
+
+
+
+ {selected &&
+ {selected?.name === "macos" && } + {selected?.name === "linux" && } + {selected?.name === "windows" && } +
} +
+ ) +} \ No newline at end of file diff --git a/src/components/download/DownloadCTA.module.css b/src/components/download/DownloadCTA.module.css new file mode 100644 index 000000000..70fcc3990 --- /dev/null +++ b/src/components/download/DownloadCTA.module.css @@ -0,0 +1,161 @@ +.cta_container { + background: url('/img/processing-background-darker.svg'); + background-size: cover; + background-position: center; + color: var(--white); + margin-top: calc(var(--vertical-margin-large) * -1); + padding-top: var(--vertical-margin-large); + padding-bottom: calc(var(--vertical-margin-large) * 2); + position: relative; + z-index: 0; + + +} + +.cta_text { + flex-basis: var(--col4); + align-self: center; +} + +.screenshot { + flex-basis: var(--col4); + padding: 0; + position: relative; + min-height: min(36vw, 560px); + + &>[data-gatsby-image-wrapper] { + position: absolute; + inset: 0 calc(var(--margin) * -1) calc(var(--vertical-margin-large) * -1) 0; + } + + [data-placeholder-image] { + display: none; + } +} + +@media (--reduced) { + .cta_container { + margin-top: 0; + } + + .cta_text { + flex-basis: var(--col8); + } + + .screenshot { + display: none; + } +} + +.title { + font-weight: 500; + line-height: 1.2; + font-size: var(--text-xxxlarge); + padding-bottom: var(--gutter); + color: var(--white); +} + +.intro { + font-size: var(--text-large); + color: var(--white); +} + +.cta_buttons { + width: fit-content; +} + +.actions { + display: flex; + gap: var(--gutter); + padding: var(--vertical-margin-medium) 0; + position: relative; + z-index: 0; +} + +.actions > a { + white-space: nowrap; +} + +@media (--medium) { + .actions > a { + padding-inline: var(--gutter); + font-size: var(--text-small); + } +} + +@media (--reduced) { + .actions > a { + padding-inline: var(--gutter-double); + font-size: var(--text-regular); + } +} + +@media (--small) { + .actions { + flex-direction: column; + } + + .actions > *::before { + display: none; + } +} + +.software { + color: var(--processing-blue); +} + +.otherPlatforms { + margin-top: var(--vertical-margin-small); + font-size: var(--text-small); + display: flex; + gap: var(--gutter); + justify-content: center; + align-items: center; +} + +.otherPlatforms h4 { + color: var(--white); + font-weight: 100; + margin: 0; +} + +.otherPlatforms ul { + list-style: none; + padding: 0; + margin: 0; + display: flex; + gap: var(--gutter); +} + +.icon { + width: 1.5em; + height: 1.5em; + font-size: var(--text-medium); +} + +@media (--medium) { + .intro { + font-size: var(--text-medium); + } +} + +@media (--reduced) { + .intro { + font-size: var(--text-large); + } +} + +@media (--small) { + .cta_buttons { + width: auto; + } + + .cta_container { + padding-top: calc(var(--vertical-margin-large) * 2); + padding-bottom: calc(var(--vertical-margin-large) * 2); + } + + .intro { + font-size: var(--text-medium); + } +} diff --git a/src/components/download/Platform.js b/src/components/download/Platform.js new file mode 100644 index 000000000..0feac9d77 --- /dev/null +++ b/src/components/download/Platform.js @@ -0,0 +1,81 @@ +import { graphql, useStaticQuery } from 'gatsby'; +import React, { useEffect, useMemo, useState } from 'react'; +import LogoWindows from '../../images/logo-windows.svg'; +import LogoMac from '../../images/logo-macos.svg'; +import LogoLinux from '../../images/logo-linux.svg'; +import LogoRaspberry from '../../images/logo-raspberry.svg'; + +export function usePlatforms() { + const queryResults = useStaticQuery( + graphql` + query FindPlatforms { + allFile(filter: {sourceInstanceName: {eq: "download"}, relativeDirectory: {eq: "platforms"}}) { + edges { + node { + name + childJson { + title + userAgent + sort + assets + } + } + } + } + } + `) + + const sorted = useMemo(() => queryResults + .allFile.edges + .map(e => { + const { childJson, ...rest } = e.node; + return { ...childJson, ...rest }; + }) + .sort((a, b) => (a.sort || 0) - (b.sort || 0)) + , [queryResults]); + + return sorted; +} + + +export function useGuessedPlatform() { + const platforms = usePlatforms(); + const [selected, setSelected] = useState(); + useEffect(() => { + const override = window.location.search.match(/platform=([^&]+)/)?.[1]; + if (override) { + const node = platforms.find(node => node.name === override); + if (node) { + setSelected(node); + return; + } + } + + const { userAgent } = navigator; + for (let node of platforms) { + if (userAgent.search(node.userAgent) === -1) continue + setSelected(node); + return; + } + setSelected(platforms.find(node => node.name === "windows")) + }, [platforms]) + const rest = platforms.filter(node => node !== selected); + return { selected, rest }; +} + + +export function PlatformIcon({ platform, ...rest }) { + if (platform?.name === "macos") { + return ; + } else if (platform?.name === "windows") { + return ; + } else if (platform?.name === "linux") { + return ; + } else if (platform?.name === "raspberry-pi") { + return ; + } + else { + return null; + } +} + diff --git a/src/components/sketch/Sketch.js b/src/components/sketch/Sketch.js index 035653328..7aaab0749 100644 --- a/src/components/sketch/Sketch.js +++ b/src/components/sketch/Sketch.js @@ -43,9 +43,9 @@ const initialState = { ] }; -const Sketch = ({ children }) => { +const Sketch = ({ children, fullscreen = false }) => { const [state, setState] = useState(null); - const [showCode, setShowCode] = useState(false); + const [showCode, setShowCode] = useState(fullscreen); const intl = useIntl(); // Load saved graphic from localstorage when component mounts in client @@ -114,8 +114,9 @@ const Sketch = ({ children }) => {
+ - + }
diff --git a/src/components/sketch/Sketch.module.css b/src/components/sketch/Sketch.module.css index 216f1b983..efcd9a921 100644 --- a/src/components/sketch/Sketch.module.css +++ b/src/components/sketch/Sketch.module.css @@ -1,9 +1,7 @@ .root { - background-image: linear-gradient( - to right, - white 20%, - var(--processing-blue-gradient) - ); + background-image: linear-gradient(to right, + white 20%, + var(--processing-blue-gradient)); } .editorBtn { @@ -73,8 +71,7 @@ display: block; } - .code, - .editorBtn { - display: none; + .code.codeVisible { + transform: translate(0, 0); } -} +} \ No newline at end of file diff --git a/src/components/sketch/SketchCode.js b/src/components/sketch/SketchCode.js index 182ced673..df61f57ad 100644 --- a/src/components/sketch/SketchCode.js +++ b/src/components/sketch/SketchCode.js @@ -26,8 +26,8 @@ const SketchCode = ({ useEffect(() => { setTimeout(() => { - if (isVisible) showGridButton.current.focus(); - else showGridButton.current.blur(); + // if (isVisible) showGridButton.current.focus(); + // else showGridButton.current.blur(); }, 500); }, [isVisible]); diff --git a/src/hooks/download.js b/src/hooks/download.js index 8c5495fe4..2899f15f7 100644 --- a/src/hooks/download.js +++ b/src/hooks/download.js @@ -121,7 +121,7 @@ export const usePreparedReleases = (releases) => { Hook to detect the OS where the site is mounted. Will default to Windows if fails to detect other. **/ -export const useMachineOS = (releases) => { +export const useMachineOS = (releases, preferredOS) => { const [detected, setDetected] = useState({ os: '', asset: null @@ -142,7 +142,9 @@ export const useMachineOS = (releases) => { }; const { userAgent } = navigator; - if (userAgent.search('Windows') !== -1) { + if (releases[preferredOS]?.length) { + selectOS(preferredOS); + } else if (userAgent.search('Windows') !== -1) { selectOS('Windows'); } else if (userAgent.search('Mac') !== -1) { selectOS('macOS'); @@ -151,7 +153,7 @@ export const useMachineOS = (releases) => { } else { selectOS('Windows'); } - }, [releases, selectAsset]); + }, [releases, preferredOS, selectAsset]); return detected; }; diff --git a/src/images/download-linux.png b/src/images/download-linux.png new file mode 100644 index 000000000..5f0a8d005 Binary files /dev/null and b/src/images/download-linux.png differ diff --git a/src/images/download-macos.png b/src/images/download-macos.png new file mode 100644 index 000000000..24716a65a Binary files /dev/null and b/src/images/download-macos.png differ diff --git a/src/images/download-windows.png b/src/images/download-windows.png new file mode 100644 index 000000000..2c1042d26 Binary files /dev/null and b/src/images/download-windows.png differ diff --git a/src/pages/index.js b/src/pages/index.js index a12f2024b..75e611dbb 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -22,6 +22,7 @@ import DMALogo from '../images/partners/ucla-dma.svg'; import FathomLogo from '../images/partners/fathom.svg'; import NetlifyLogo from '../images/partners/netlify.svg'; import UptimeRobotLogo from '../images/partners/uptimerobot.svg'; +import DownloadCTA from '../components/download/DownloadCTA'; const partners = [ { @@ -83,35 +84,17 @@ const IndexPage = ({ data }) => { title={intl.formatMessage({ id: 'introTitle' })} description={intl.formatMessage({ id: 'introText' })} /> - -
-

{intl.formatMessage({ id: 'introTitle' })}

-

{intl.formatMessage({ id: 'introText' })}

-
- - - -
+ +
+
+

Sketch with code

+

+ In Processing, everything is code, even the logo!
+ Try changing a few values and see what happens. +

- +
+ { return (
-

{heading}

+

Learn Through Examples

+

+ Processing includes many examples you can run and modify. Open one, change
+ the code, and make something new. This is a great way to learn! +

{examples.map((example) => (
diff --git a/src/styles/variables.css b/src/styles/variables.css index 816fb593d..ec561f226 100644 --- a/src/styles/variables.css +++ b/src/styles/variables.css @@ -28,6 +28,7 @@ --foundation-mid: #9c4bff; --foundation-dark: #5501a4; + --white: #ffffff; --lightgray: #f5f5f5; --gray: #dbdbdb; --darkgray: #898989; @@ -37,6 +38,9 @@ --download-background: #F2F6FF; --download-inactive: #8890B3; --download-background-active: rgba(80, 139, 255, 0.08); + --donate-bg-start: #111956; + --donate-bg-end: #3441A2; + --donate-shadow: #8BADF9; --text-xsmall: 0.8rem; --text-small: 0.875rem; diff --git a/src/templates/download.js b/src/templates/download.js index 783b55e08..e45c0df41 100644 --- a/src/templates/download.js +++ b/src/templates/download.js @@ -31,7 +31,7 @@ import * as grid from '../styles/grid.module.css'; // Set to false to hide the Donate character const showDonate = false; -const Download = ({ data }) => { +const Download = ({ data, pageContext }) => { const intl = useIntl(); const releases = usePreparedReleases(data.releases.nodes); const prereleases = usePreparedReleases(data.prereleases.nodes); @@ -101,6 +101,7 @@ const Download = ({ data }) => { @@ -191,9 +192,9 @@ const PreReleaseSwitch = memo(({ releases, prereleases, selectedRelease, setSele ) }); -const MainDownloadSection = memo(({ release, onAfterDownload }) => { +const MainDownloadSection = memo(({ release, preferredOS, onAfterDownload }) => { const intl = useIntl(); - const detectedAsset = useMachineOS(release.assetsByOs, release.publishedAt); + const detectedAsset = useMachineOS(release.assetsByOs, preferredOS); const appleSiliconAsset = useMemo(() => release.assets.find(asset => detectedAsset.os === "macOS" && asset.os === "macOS" && asset.bit === "Intel"), [release, detectedAsset]); diff --git a/static/img/processing-background-darker.svg b/static/img/processing-background-darker.svg new file mode 100644 index 000000000..d222a5b43 --- /dev/null +++ b/static/img/processing-background-darker.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +