Skip to content

Commit

Permalink
Update documentation site links and branding
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianWalters authored and carbonrobot committed Apr 10, 2024
1 parent 4a21fd4 commit 25bc0fc
Show file tree
Hide file tree
Showing 36 changed files with 749 additions and 240 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<p align="center">
<a href="https://formidable.com/open-source/" target="_blank">
<img alt="React Live — Formidable, We build the modern web" src="https://raw.githubusercontent.com/FormidableLabs/react-live/master/react-live-Hero.png" />
<a href="https://commerce.nearform.com/open-source/" target="_blank">
<img alt="React Live — Formidable, We build the modern web" src="https://oss.nearform.com/api/banner.svg?text=react+live" />
</a>
</p>
<p align="center">
<strong>A flexible playground for live editing React code</strong>
<br><br>
<a href="https://npmjs.com/package/react-live"><img src="https://img.shields.io/npm/dm/react-live.svg"></a>
<a href="https://npmjs.com/package/react-live"><img src="https://img.shields.io/npm/v/react-live.svg"></a>
<img src="https://img.badgesize.io/https://unpkg.com/react-live/dist/react-live.min.js?compression=gzip&label=gzip%20size">
<img src="https://img.badgesize.io/https://unpkg.com/react-live/dist/react-live.min.js?label=size">
<img src="https://img.shields.io/badge/module%20formats-umd%2C%20cjs%2C%20esm-green.svg">
<a href="https://github.com/FormidableLabs/react-live#maintenance-status">
Expand All @@ -22,7 +21,7 @@ The library is structured modularly and lets you style and compose its component

<p align="center"><img src="https://user-images.githubusercontent.com/17658189/63181897-1d67d380-c049-11e9-9dd2-7da2a3a57f05.gif" width=500></p>

Come learn more at our [docs site](https://formidable.com/open-source/react-live)!
Come learn more at our [docs site](https://commerce.nearform.com/open-source/react-live)!

## Support

Expand Down
36 changes: 34 additions & 2 deletions docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { DemoLiveEditor } from "../website/src/components/live-edit";

# Introduction

[![React Live — Formidable, We build the modern web](https://github.com/FormidableLabs/react-live/master/react-live-Hero.png)](https://formidable.com/open-source/)

**React Live** brings you the ability to render React components with editable source code and live preview. React Live is structured modularly and lets you style and compose its components freely. The following demos show typical use cases including the editor, preview, and error pane components.

To see React Live in action, make changes to the following editor panes:
Expand All @@ -30,6 +28,17 @@ export const jsxExample = `

<DemoLiveEditor code={jsxExample} />

```jsx
import { LiveProvider, LiveEditor, LivePreview } from "react-live";

<LiveProvider code={code}>
<div className="grid grid-cols-2 gap-4">
<LiveEditor className="font-mono" />
<LivePreview />
</div>
</LiveProvider>
```

### Render-function Demo

To render a series of components or render components beyond just JSX, React Live also provides a `render` function to pass JSX into when the `noInline` prop is present. This lets you render multiple or functional components with hooks. This example shows a functional component with a `useState` hook.
Expand Down Expand Up @@ -65,6 +74,17 @@ render(<Counter label="Counter" />)

<DemoLiveEditor code={noInlineExample} noInline />

```jsx
import { LiveProvider, LiveEditor, LivePreview } from "react-live";

<LiveProvider code={code} noInline>
<div className="grid grid-cols-2 gap-4">
<LiveEditor className="font-mono" />
<LivePreview />
</div>
</LiveProvider>
```

### Syntax Error Demo

React Live can also display customizable errors when your code contains errors.
Expand All @@ -74,3 +94,15 @@ const badVariable = ;
`.trim();

<DemoLiveEditor code={syntaxError} />

```jsx
import { LiveProvider, LiveEditor, LivePreview, LiveError } from "react-live";

<LiveProvider code={code}>
<div className="grid grid-cols-2 gap-4">
<LiveEditor className="font-mono" />
<LivePreview />
<LiveError className="text-red-800 bg-red-100 mt-2" />
</div>
</LiveProvider>
```
317 changes: 221 additions & 96 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Binary file removed react-live-Hero.png
Binary file not shown.
35 changes: 15 additions & 20 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ const { themes } = require("prism-react-renderer");
const config = {
title: "React Live",
tagline: "A flexible playground for live editing React components",
url: "https://formidable.com",
baseUrl:
process.env.VERCEL_ENV === "preview" ? "/" : "/open-source/react-live",
url: "https://commerce.nearform.com",
baseUrl: "/open-source/react-live",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "Formidable",
projectName: "react-live", // Usually your repo name.
favicon: "img/nearform-icon.svg",

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
Expand All @@ -34,7 +28,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: "/",
routeBasePath: "/docs",
path: "../docs",
sidebarPath: require.resolve("./sidebars.js"),
editUrl:
Expand Down Expand Up @@ -67,27 +61,28 @@ const config = {
navbar: {
title: "React Live",
logo: {
alt: "Formidable logo",
src: "img/formidable-f.svg",
alt: "Nearform",
src: "/img/nearform-logo-white.svg",
},
items: [
{ to: "docs", label: "Documentation", position: "left" },
{
href: "https://github.com/FormidableLabs/react-live",
className: "header-github-link",
"aria-label": "GitHub Repository",
position: "right",
},
{
href: "https://formidable.com",
className: "header-formidable-link",
"aria-label": "Formidable Website",
position: "right",
},
],
},
footer: {
style: "dark",
copyright: `Copyright © ${new Date().getFullYear()} Formidable`,
logo: {
alt: "Nearform logo",
src: "img/nearform-logo-white.svg",
href: "https://nearform.com",
width: 100,
height: 100,
},
copyright: `Copyright © 2013-${new Date().getFullYear()} Nearform`,
},
prism: {
theme: themes.nightOwlLight,
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@docusaurus/module-type-aliases": "2.4.0",
"@docusaurus/types": "^2.4.0",
"@tsconfig/docusaurus": "^1.0.5",
"formidable-oss-badges": "^1.3.2",
"typescript": "^4.7.4"
},
"browserslist": {
Expand Down
Binary file added website/src/assets/fonts/inter/InterBold.woff2
Binary file not shown.
Binary file added website/src/assets/fonts/inter/InterMedium.woff2
Binary file not shown.
Binary file added website/src/assets/fonts/inter/InterRegular.woff2
Binary file not shown.
Binary file added website/src/assets/images/hero-pattern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/native-support.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/responsive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/assets/images/style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions website/src/components/landing/landing-banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { NFLinkButton } from './nf-link-button';
import { LandingDivider } from './landing-divider';

export const LandingBanner = ({
body,
cta,
heading,
showDivider,
}: {
body: string;
cta: { link: string; text: string };
heading: string;
showDivider?: boolean;
}) => (
<div className="flex flex-col text-left mx-16 lg:mx-32 xl:mx-64 my-8">
{showDivider && <LandingDivider />}

<h2 className="my-8 text-4xl font-semibold">{heading}</h2>
<p className="text-lg">{body}</p>
<NFLinkButton link={cta.link}>{cta.text}</NFLinkButton>
</div>
);
5 changes: 5 additions & 0 deletions website/src/components/landing/landing-divider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

export const LandingDivider = () => (
<div className="mt-8 h-px bg-grayscale-300" />
);
58 changes: 58 additions & 0 deletions website/src/components/landing/landing-featured-projects.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import { FeaturedBadge } from "formidable-oss-badges";
import { NFLinkButton } from "./nf-link-button";
import { LandingDivider } from "./landing-divider";

type featuredProject =
| "renature"
| "spectacle"
| "urql"
| "victory"
| "nuka"
| "owl"
| "groqd"
| "envy"
| "figlog";

export const LandingFeaturedProjects = ({
heading,
projects,
showDivider,
}: {
heading: string;
projects: {
name: featuredProject;
link: string;
description: string;
title?: string;
}[];
showDivider?: boolean;
}) => (
<div className="flex flex-col text-left mx-16 lg:mx-32 xl:mx-64 mt-12 py-12">
{showDivider && <LandingDivider />}
<h2 className="my-8 text-4xl font-semibold">{heading}</h2>
<div className="grid grid-cols-2 gap-8">
{projects.map(({ name, link, description, title }) => (
<a
href={link}
key={link}
className="col-span-2 sm:col-span-1 block grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 align-center items-center text-theme-2 hover:text-theme-2 dark:text-white dark:hover:text-white"
>
<FeaturedBadge name={name} isHoverable className="col-span-1" />
<span className="flex flex-col col-span-1 lg:col-span-2">
<span className="text-xl font-semibold capitalize">
{title || name}
</span>
<span className="text-sm ">{description}</span>
</span>
</a>
))}
</div>

<div className="my-8 pt-8 align-center">
<NFLinkButton link="https://commerce.nearform.com/open-source">
View All Projects
</NFLinkButton>
</div>
</div>
);
26 changes: 26 additions & 0 deletions website/src/components/landing/landing-features.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { LandingDivider } from './landing-divider';

export const LandingFeatures = ({
heading,
list,
showDivider,
}: {
heading: string;
list: { imgSrc: string; alt: string; title: string; body: string }[];
showDivider?: boolean;
}) => (
<div className="flex flex-col text-left mx-16 lg:mx-32 xl:mx-64 my-12">
{showDivider && <LandingDivider />}
<h2 className="my-8 text-4xl font-semibold">{heading}</h2>
<ul className="grid grid-cols-3 items-start content-start justify-items-start justify-between gap-12 list-none pl-0">
{list.map(({ alt, body, imgSrc, title }) => (
<li className="col-span-3 md:col-span-1 flex flex-col items-center text-center">
<img src={imgSrc} alt={alt} className="max-h-72" />
<span className="mt-8 text-2xl font-semibold">{title}</span>
<span className="mt-2 text-lg leading-8 mx-3">{body}</span>
</li>
))}
</ul>
</div>
);
61 changes: 61 additions & 0 deletions website/src/components/landing/landing-hero.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from "react";
import { ProjectBadge } from "formidable-oss-badges";

export const LandingHero = ({
body,
copyText,
heading,
navItems,
}: {
body: string;
copyText: string;
heading: string;
navItems: { link: string; title: string }[];
}) => {
return (
<div className="hero-pattern w-fill bg-cover bg-no-repeat">
<div className="py-12 lg:py-24 mx-16 lg:mx-32 xl:mx-64 relative">
<div className="flex-col md:flex-row flex justify-between gap-16 lg:gap-24 mx-auto">
<div className="self-center md:self-left">
<ProjectBadge
abbreviation="Re"
color="#5ABDEE"
description="React Live"
className="h-[320px] w-[320px]"
/>
</div>
<div className="text-left lg:w-6/12 text-white">
<h1 className="text-4xl font-bold tracking-tight sm:text-6xl">
{heading}
</h1>
<p className="mt-6 text-lg leading-8">{body}</p>
<div className="mt-10 flex flex-wrap flex-col xl:flex-row xl:items-center justify-start gap-6">
<button
className="overflow-hidden grid-rows-2 md:grid-rows-1 lg:max-w-fit grid lg:grid-cols-6 align-center rounded-md shadow-sm border-none bg-white my-0 py-0 px-0 text-sm font-semibold text-theme-2 hover:text-theme-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-theme-1"
onClick={() => navigator.clipboard.writeText(copyText)}
>
<code className="max-w-fit py-2.5 pl-3.5 content-center grid-span-12 lg:col-span-4 border-0 bg-white">
{copyText}
</code>
<span className="w-full lg:min-w-fit col-span-2 capitalize rounded-b-md lg:rounded-l-none lg:!rounded-r-md text-theme-2 bg-theme-1 lg:ml-2 pr-3.5 lg:pl-2.5 py-2.5 h-full">
Copy
</span>
</button>
</div>
<nav className="mt-6">
<ul className="list-none flex justify-items-start content-start items-start align-left pl-0 gap-6 lg:gap-12 font-bold">
{navItems.map(({ link, title }) => (
<li key={link}>
<a href={link} className="text-white hover:text-white">
{title}
</a>
</li>
))}
</ul>
</nav>
</div>
</div>
</div>
</div>
);
};
30 changes: 30 additions & 0 deletions website/src/components/landing/landing-logos.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { LandingDivider } from './landing-divider';

export const LandingLogos = ({
body,
heading,
list,
showDivider,
}: {
body: string;
heading: string;
list: { imgSrc: string; alt: string }[];
showDivider?: boolean;
}) => (
<div>
<div className="flex flex-col text-left mx-16 lg:mx-32 xl:mx-64 my-12">
{showDivider && <LandingDivider />}

<h2 className="my-8 text-4xl font-semibold">{heading}</h2>
<p className="text-lg max-w-prose">{body}</p>
<ul className="grid grid-cols-4 items-center content-start justify-items-start gap-8 list-none pl-0">
{list.map(({ imgSrc, alt }) => (
<li className="col-span-1 ">
<img src={imgSrc} alt={alt} />
</li>
))}
</ul>
</div>
</div>
);
18 changes: 18 additions & 0 deletions website/src/components/landing/nf-link-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

interface ButtonProps {
children: ChildNode | React.ReactNode;
link: string;
screenReaderLabel?: string;
}

export const NFLinkButton = ({ children, link }: ButtonProps) => {
return (
<a
className="bg-button-bg text-button-fg border-button-border hover:text-button-fg-hover after:bg-button-bg-hover border-2 font-bold rounded-full text-lg z-0 transition-colors delay-75 w-fit overflow-hidden py-[14px] px-[23px] relative flex gap-2.5 justify-between leading-[21px] after:absolute after:w-[200%] after:h-full after:bottom-0 after:transform-gpu after:-skew-x-[50deg] after:-right-[250%] after:-z-10 after:transition-transform after:duration-200 hover:after:-translate-x-[100%] hover:after:[-webkit-transform:translate3d(-100%,0,0)_!important]"
href={link}
>
{children}
</a>
);
};
Loading

0 comments on commit 25bc0fc

Please sign in to comment.