Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a getting started page #254

Merged
merged 33 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d0dab67
added getting started page
fraincs May 2, 2024
9fae47f
addes info in getting started page
fraincs May 6, 2024
4bf7cf1
added a callout component - updated getting started copy
fraincs May 7, 2024
2031007
intro adjustments
fraincs May 7, 2024
08384dc
updated copy and title size
fraincs May 7, 2024
ae089b2
removed package manager field in package to fix build issues
fraincs May 7, 2024
1eb877a
fixed linting error
fraincs May 7, 2024
21a493b
removed unneeded import
fraincs May 7, 2024
81c2ccc
fix for build issue of getting-started-page
fraincs May 7, 2024
6556066
fixed typing issue with new component
fraincs May 7, 2024
08cacc4
added dependency on react-aria
fraincs May 7, 2024
0776f0d
updated package lock file
fraincs May 7, 2024
c42273a
fix dependency version
alexasselin008 May 7, 2024
ad8854d
Merge branch 'main' into feature/getting-started
alexasselin008 May 7, 2024
d8c77a4
fix linting
alexasselin008 May 7, 2024
ef58cb9
fixed some typo
fraincs May 7, 2024
6896ecb
pr fixes
fraincs May 10, 2024
30a5012
Merge branch 'main' into feature/getting-started
fraincs May 15, 2024
c136145
swapped color for package picker
fraincs May 15, 2024
127a150
Merge branch 'main' into feature/getting-started
fraincs May 24, 2024
211abd3
merge
fraincs May 27, 2024
762429d
wip
fraincs May 29, 2024
4b08085
PR fixes
fraincs Jun 4, 2024
a2213aa
Merge branch 'main' into feature/getting-started
fraincs Jun 7, 2024
56afe60
wip
fraincs Jun 11, 2024
723cd2f
merge
fraincs Jun 11, 2024
d00c1d1
added nes getting-started sectino
fraincs Jun 12, 2024
433c2e0
fix render of getting-started pages
Jun 12, 2024
ca8749b
moved getting started files
fraincs Jun 13, 2024
3d57054
unfixed comments
fraincs Jun 13, 2024
d7009ad
pr fixes
fraincs Jun 13, 2024
4e39ea6
removed unnecessary pages
fraincs Jun 14, 2024
ed0b622
added an import
fraincs Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/docs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
},
"globals": {
"Card": true,
"Callout": true,
"Collapsible": true,
"Table": true,
"MotionPreview": true,
"Footnote": true,
Expand Down
29 changes: 29 additions & 0 deletions apps/docs/app/pages/getting-started/page.tsx
fraincs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use client";

import { allPages } from "contentlayer/generated";
import Mdx from "@/components/mdx/Mdx";
import { notFound } from "next/navigation";
import Aside from "@/app/ui/layout/aside/Aside.tsx";
import getSectionLinks from "@/app/lib/getSectionLinks";

export default function GettingStartedPage() {
const page = allPages.find(gettingStartedPage => gettingStartedPage._id === "pages/getting-started.mdx");

if (!page) {
notFound();
}

const sectionLinks = getSectionLinks(page);

return (
<div className="hd-wrapper hd-flex">
<Aside title="On this page" links={sectionLinks} />
<main>
<article className="hd-content" key={page._id}>
<h1 className="hd-title hd-title--level1">{page.title}</h1>
fraincs marked this conversation as resolved.
Show resolved Hide resolved
{page.body && <Mdx code={page.body.code} />}
</article>
</main>
</div>
);
}
2 changes: 2 additions & 0 deletions apps/docs/app/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
--hd-color-neutral-border: var(--hd-neutral-75);
--hd-color-neutral-border-weak: var(--hd-neutral-20);
--hd-color-accent-text: var(--hd-accent-700);
--hd-color-accent-border: var(--hd-accent-700);
--hd-color-accent-surface: var(--hd-accent-100);
--hd-color-surface-neutral-gradient: linear-gradient(0deg, #151515 0%, #353434 100%);
--hd-color-surface-neutral-gradient-hover: linear-gradient(0deg, #353434 0%, #151515 100%);
Expand Down Expand Up @@ -110,6 +111,7 @@
--hd-color-neutral-icon-weak-hover: var(--hd-neutral-0);
--hd-color-neutral-border: var(--hd-neutral-700);
--hd-color-accent-text: var(--hd-accent-300);
--hd-color-accent-border: var(--hd-accent-700);
--hd-color-accent-surface: var(--hd-accent-900);
--hd-color-surface-neutral-gradient: linear-gradient(0deg, #F4F3EE 0%, var(--hd-neutral-0) 100%);
--hd-color-surface-neutral-gradient-hover: linear-gradient(0deg, var(--hd-neutral-0) 0%, #F4F3EE 100%);
Expand Down
18 changes: 18 additions & 0 deletions apps/docs/components/callout/Callout.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from "@storybook/react";

import Callout from "./Callout.tsx";


fraincs marked this conversation as resolved.
Show resolved Hide resolved
const meta = {
title: "components/Callout",
component: Callout
} satisfies Meta<typeof Callout>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
children: "Content of the callout"
}
};
17 changes: 17 additions & 0 deletions apps/docs/components/callout/Callout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { ReactNode } from "react";

import "./callout.css";

export interface CalloutProps {
children: ReactNode;
}

const Callout = ({ children }: CalloutProps) => {
return (
<div className="hd-callout">
{children}
</div>
);
};

export default Callout;
6 changes: 6 additions & 0 deletions apps/docs/components/callout/callout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.hd-callout {
background-color: var(--hd-color-accent-surface);
border-radius: 0.25rem;
border-left: 0.25rem solid var(--hd-color-accent-border);
padding: 1rem;
}
2 changes: 2 additions & 0 deletions apps/docs/components/mdx/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { HTMLAttributes } from "react";
import dynamic from "next/dynamic";

import Card from "@/components/card/Card.tsx";
import Callout from "@/components/callout/Callout.tsx";
import NextImage from "@/components/image/Image.tsx";
import Pre from "@/components/pre/Pre.tsx";
import InlineCode from "@/components/code/InlineCode.tsx";
Expand Down Expand Up @@ -32,6 +33,7 @@ const PropTable = dynamic(() => import("@/app/ui/components/propTable/PropTable.
export const components = {
Card,
code: InlineCode,
Callout: Callout,
Image: NextImage,
pre: Pre,
MotionPreview: MotionPreview,
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/components/title/title.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
}

.hd-title--level4 {
font-size: 1em;
font-size: 1.125em;
margin-block: 1.5rem 0.75rem;
}

.hd-title--level5 {
font-size: 0.825em;
font-size: 1rem;
margin-block: 1rem 0.625rem;
}

Expand Down
187 changes: 187 additions & 0 deletions apps/docs/content/pages/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Getting started
description: Getting started with Workleap Design Tokens
---

This guide will help you get started with Hopper UI. Hopper UI is a Design System that provides a collection of components, tokens, and icons to help you build applications.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

## Quick Install

To use Hopper in your project, run one of these commands in your terminal.

<PackageInstallation library="components @hopper-ui/icons @hopper-ui/tokens @hopper-ui/styled-system" mod="prod" />
fraincs marked this conversation as resolved.
Show resolved Hide resolved
fraincs marked this conversation as resolved.
Show resolved Hide resolved
fraincs marked this conversation as resolved.
Show resolved Hide resolved

After installing Hopper UI packages, you must setup a Provider at the root of your application. This is typically in your _index.tsx_ or _app.tsx_, but can vary based on your specific setup.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

fraincs marked this conversation as resolved.
Show resolved Hide resolved
```jsx
fraincs marked this conversation as resolved.
Show resolved Hide resolved
import { HopperProvider } from "@hopper-ui/components";

<HopperProvider colorScheme="light">
<Button>Hello World</Button>
</HopperProvider>
```

<Callout>Hopper is compatible with React 18. Not using React, or using an older version than 18? You can still benefit from Hopper, read on to discover how.</Callout>

## Detailed Installation

### Components
fraincs marked this conversation as resolved.
Show resolved Hide resolved

Hopper Components are React Comtponents, uf you are using another framework, or React Native, you should use the [components tokens](/tokens/getting-started/introduction) directly when developping your own components.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

#### Installation

Run one of the following commands in your terminal to install the Hopper Components package.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

<PackageInstallation library="components" mod="prod" />

#### Usage

A Provider is required to use Hopper Components. Wrap your application with the HopperProvider component to use our components.

```jsx
import { Button } from "@hopper-ui/components";

<HopperProvider theme="dark">
<Button>Hello World</Button>
</HopperProvider>
```

### Tokens

Hopper Tokens are a collection of design tokens that should be used to style your application. [Semantic tokens](#) are available for everyone, where [components tokens](#) are designed with non React users in mind.

#### Installation

<PackageInstallation library="tokens" mod="prod" />

#### Usage

##### CSS

Import the tokens in your project by doing the following:

```css
@import "@hopper-ui/tokens/tokens.css";
fraincs marked this conversation as resolved.
Show resolved Hide resolved
```

If your application supports a dark mode, import dark mode tokens as well:

```css
@import "@hopper-ui/tokens/dark/tokens.css";
```

You can now use Hopper tokens in your project by using the following syntax:

```css
.my-class {
background-color: var(--hop-primary-surface-weak);
}
```

##### Fonts

In order to use Hopper fonts in your project, import the following:

```css
@import "@hopper-ui/tokens/fonts.css";
```

All the necessary font-face declarations are now imported in your project.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

### Icons

#### Installation

<PackageInstallation library="icons" mod="prod" />

#### Usage

You can now use [icons](/icons/react-icons/icon-library) and [rich icons](/icons/react-icons/rich-icon-library) in your project by using the following syntax:

```tsx
import { AddIcon } from "@hopper-ui/icons";
fraincs marked this conversation as resolved.
Show resolved Hide resolved
import { ConversationRichIcon } from "@hopper-ui/icons";

<AddIcon />
<ConversationRichIcon />
```

#### Non-standard installations
fraincs marked this conversation as resolved.
Show resolved Hide resolved

##### SVG Icons

If your project is not using the React framework, you can use the SVG icons directly. You can find the SVG icons in the `@hopper-ui/svg-icons` package.

<PackageInstallation library="svg-icons" mod="prod" />

You can import the SVG directly into your JavaScript file. Keep in mind that if you plan to use SVG icons as components, you'll need to ensure that your bundler is configured to handle SVG parsing appropriately.

```tsx
import alertIcon from "@hopper-ui/svg-icons/alert-24.svg";
```

Alternatively, you can utilize SVG icons within your CSS in the following manner:

```css
.myComponent {
background-image: url("@hopper-ui/svg-icons/alert-24.svg");
}
```

##### React Icons Standalone Installation
fraincs marked this conversation as resolved.
Show resolved Hide resolved

It is recommended to use `@hopper-ui/icons` with `@hopper-ui/components`. The standalone installation procedure is detailed in case you only need the icons, and not the components. This is also the installation process until the components are released.

<PackageInstallation library="icons @hopper-ui/styled-system react-aria-components" mod="prod" />

Import the styles in your project:

```css
@import "@hopper-ui/icons/index.css";
@import "@hopper-ui/styled-system/index.css";
```

Configuring your application it a little different:
fraincs marked this conversation as resolved.
Show resolved Hide resolved

```tsx
import { StyledSystemProvider } from "@hopper-ui/styled-system";
import { createRoot } from "react-dom/client";
import App from "./App";

const root = createRoot(document.getElementById("root")!);

root.render(
<StyledSystemProvider withBodyStyle colorScheme="light">
<App />
</StyledSystemProvider>
);
```

Using the icon is the exact same way as with the default package.

```tsx
import { AddIcon } from "@hopper-ui/icons";

<AddIcon />
```

##### React 16 Installation

If your'e still using React 16, you need to use the `@hopper-ui/icons-react16` package.
fraincs marked this conversation as resolved.
Show resolved Hide resolved

<PackageInstallation library="icons-react16" mod="prod" />

The usage is the same as the default package, you only need to import the icons from a different package.

```tsx
import { AddIcon } from "@hopper-ui/icons-react16";
fraincs marked this conversation as resolved.
Show resolved Hide resolved
import { ConversationRichIcon } from "@hopper-ui/icons-react16";

<AddIcon />
<ConversationRichIcon />
```

## Contribute

Pull requests are welcome. For major changes, please open a [discussion](https://github.com/gsoft-inc/wl-hopper/discussions/new/choose) first to discuss what you would like to change. If you're interested in contributing, check out our [Contributing Guide](https://github.com/gsoft-inc/wl-hopper/blob/main/CONTRIBUTING.md)!
1 change: 1 addition & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"next-contentlayer": "0.3.4",
"next-mdx-remote": "^4.4.1",
"react": "18.3.1",
"react-aria": "3.33.0",
"react-aria-components": "1.2.0",
"react-dom": "18.3.1",
"react-toggle": "4.1.3",
Expand Down
Loading
Loading