From cb021aab4d00629c2c1c401142f2c9dc9bb46202 Mon Sep 17 00:00:00 2001 From: Federico Zivolo Date: Fri, 26 May 2023 19:47:44 +0200 Subject: [PATCH] show banner to Floating UI website --- src/components/Header.js | 12 ++++-- src/components/Landing.js | 10 ++++- src/components/Layout.js | 78 ++++++++++++++++++++++++++++++++---- src/components/Navigation.js | 2 +- 4 files changed, 90 insertions(+), 12 deletions(-) diff --git a/src/components/Header.js b/src/components/Header.js index 0596f897..f5718399 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -113,8 +113,8 @@ const iconCss = css` margin-right: 5px; `; -const Header = () => ( - +const Header = ({ className }) => ( + ( srcset={popperLogo} media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" /> - + diff --git a/src/components/Landing.js b/src/components/Landing.js index 60b35899..843d9660 100644 --- a/src/components/Landing.js +++ b/src/components/Landing.js @@ -41,6 +41,7 @@ import 'modern-normalize'; import '@openfonts/luckiest-guy_latin'; import './layout.css'; import './prism-base2tone-pool-dark.css'; +import { FloatingUIBanner } from './Layout'; import popcornBox from '../images/popcorn-box.svg'; import { css } from '@emotion/react'; @@ -664,10 +665,17 @@ const Layout = ({ children }) => { return ( -
+ +
( + a: (props) => ( // eslint-disable-next-line {props.children} @@ -175,16 +175,75 @@ function anchorScroll(event) { } catch (e) {} } -const flatten = routes => +const flatten = (routes) => routes.reduce( (acc, cur) => acc.concat(cur).concat(flatten(cur.children)), [] ); +export const FloatingUIBanner = () => ( + + The future of Popper is here! Floating UI is now available. Get it now! + +); + const EditPage = ({ path }) => ( - {routes => { - const route = routes.find(route => route.slug === path); + {(routes) => { + const route = routes.find((route) => route.slug === path); return ( route && ( @@ -213,7 +272,7 @@ const Layout = ({ children, location, pageResources, ...props }) => { const validRoutes = flatten(createTree(processRoutes(routes, path))); const currentPathIndex = validRoutes.findIndex( - route => route.slug === path + (route) => route.slug === path ); return { @@ -362,7 +421,12 @@ const Layout = ({ children, location, pageResources, ...props }) => { } `} /> -
+ +
{pageResources && ( { - {routes => { + {(routes) => { const { prev, next } = getPrevNextRoutes(routes); return ( diff --git a/src/components/Navigation.js b/src/components/Navigation.js index 3b3abf46..3e22349a 100644 --- a/src/components/Navigation.js +++ b/src/components/Navigation.js @@ -15,7 +15,7 @@ export const NAVIGATION_WIDTH = 260; const Container = styled.div` background: #c83b50; position: fixed; - top: 0; + top: 4rem; height: 100%; width: ${NAVIGATION_WIDTH}px; transform: translateX(-${NAVIGATION_WIDTH}px);