This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: extract apps directory (#360)
- Loading branch information
1 parent
9bf527c
commit 1b93164
Showing
72 changed files
with
1,413 additions
and
1,199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
example-dist |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.log | ||
.DS_Store | ||
node_modules | ||
dist | ||
example-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("@singlestone/prettier-config-sugar"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<h1 align="center">Welcome to @singlestone/sugar-react 👋</h1> | ||
<p> | ||
<a href="https://npmjs.com/package/@singlestone/sugar-react" target="_blank"> | ||
<img alt="npm (scoped)" src="https://img.shields.io/npm/v/@singlestone/sugar-react"> | ||
</a> | ||
</p> | ||
|
||
> React bindings for Sugar | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
|
||
- [Prerequisites](#prerequisites) | ||
- [Installation](#installation) | ||
- [npm](#npm) | ||
- [Yarn](#yarn) | ||
- [pnpm](#pnpm) | ||
- [Setup](#setup) | ||
- [Usage](#usage) | ||
- [Development](#development) | ||
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
## Prerequisites | ||
|
||
- NodeJS 14+ | ||
- A functioning [Tailwind and Sugar setup](../../sugar/sugar/README.md#setup) | ||
|
||
## Installation | ||
|
||
Install `@singlestone/sugar-react` with your NodeJS package manager of choice. | ||
|
||
### npm | ||
|
||
```shell | ||
$ npm install @singlestone/sugar-react | ||
``` | ||
|
||
### Yarn | ||
|
||
```shell | ||
$ yarn add @singlestone/sugar-react | ||
``` | ||
|
||
### pnpm | ||
|
||
```shell | ||
$ pnpm install @singlestone/sugar-react | ||
``` | ||
|
||
## Setup | ||
|
||
After [installation](#installation), add Sugar React to your `tailwind.config.js` like so: | ||
|
||
```js | ||
// tailwind.config.js | ||
module.exports = { | ||
mode: "jit", | ||
content: [ | ||
// change this to fit your project as necessary | ||
"./src/**/*.{ts,tsx}", | ||
// add this | ||
"./node_modules/@singlestone/sugar-react/**/*.js", | ||
], | ||
plugins: [require("@singlestone/sugar").sugarCorePlugin()], | ||
}; | ||
``` | ||
|
||
## Usage | ||
|
||
Once you've followed the [Installation](#installation) and [Setup](#setup) process, you can import the various | ||
components in your application. All `@singlestone/sugar-react` components are thin wrappers around the semantic | ||
HTML elements that they represent, so you can use them exactly the same way that you'd use a normal element. | ||
|
||
```tsx | ||
import { Select, TextInput } from "@singlestone/sugar-react"; | ||
|
||
// ... | ||
<Label htmlFor="some-select">Options!</Label> | ||
<Select id="some-select"> | ||
<option disabled value="">Select an Option</option> | ||
<option value="option1">Option 1</option> | ||
</Select> | ||
``` | ||
|
||
You can also pass additional class names to each component - they'll be appended to the resulting element. | ||
|
||
```tsx | ||
<Label htmlFor="some-select">Options!</Label> | ||
<Select className="w-full" id="some-select"> | ||
<option disabled value="">Select an Option</option> | ||
<option value="option1">Option 1</option> | ||
</Select> | ||
``` | ||
|
||
## Development | ||
|
||
This package is a bit unusual in how you can develop it at the moment. It follows the | ||
conventions of all the other projects by having most steps be able to be used by | ||
things depending on it (e.g., `pnpm run dev` outputs a built version of the library and | ||
watches for file changes). You can also start a Vite server for quick development of | ||
components (until we set up Storybook for it) via `pnpm run start`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>@singlestone/sugar-react-playground</title> | ||
</head> | ||
<body class="bg-gray-100 font-sans text-slate-900 antialiased min-h-screen"> | ||
<div class="flex flex-col min-h-screen" id="root"></div> | ||
<script type="module" src="./src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "@singlestone/sugar-react-playground", | ||
"version": "0.6.2", | ||
"description": "React Playground for Sugar", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/singlestone/sugar.git", | ||
"directory": "apps/react-playground" | ||
}, | ||
"homepage": "https://github.com/singlestone/sugar/tree/main/apps/react-playground#readme", | ||
"bugs": { | ||
"url": "https://github.com/singlestone/sugar/issues" | ||
}, | ||
"author": "SingleStone Consulting (https://www.singlestoneconsulting.com/)", | ||
"license": "MIT", | ||
"private": true, | ||
"engines": { | ||
"node": "^14 || ^16 || ^18 || >= 20" | ||
}, | ||
"scripts": { | ||
"build": "vite build", | ||
"clean": "rimraf .turbo dist", | ||
"dev": "vite", | ||
"lint": "eslint --format stylish --max-warnings 0 --cache src && prettier -c src", | ||
"lint:fix": "eslint --format stylish --max-warnings 0 --cache --fix src && prettier --write src" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.0.0" | ||
}, | ||
"dependencies": { | ||
"@singlestone/sugar-react": "workspace:*", | ||
"@singlestone/sugar-tokens": "workspace:*", | ||
"clsx": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
"@singlestone/eslint-config-sugar": "workspace:*", | ||
"@singlestone/postcss-preset-sugar": "workspace:*", | ||
"@singlestone/prettier-config-sugar": "workspace:*", | ||
"@singlestone/sugar": "workspace:*", | ||
"@singlestone/tsup-config": "workspace:*", | ||
"@types/node": "20.2.3", | ||
"@types/react": "18.2.7", | ||
"@types/react-dom": "18.2.4", | ||
"@vitejs/plugin-react": "4.0.0", | ||
"prettier": "2.8.8", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"tailwindcss": "3.3.2", | ||
"vite": "4.3.8" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org", | ||
"access": "public" | ||
}, | ||
"prettier": "@singlestone/prettier-config-sugar", | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import "./index.css"; | ||
|
||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
|
||
import { App } from "./App"; | ||
|
||
createRoot(document.getElementById("root") as HTMLElement).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
); |
6 changes: 5 additions & 1 deletion
6
sugar/react/example/panels/Button.tsx → apps/react-playground/src/panels/Button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
sugar/react/example/panels/Checkbox.tsx → .../react-playground/src/panels/Checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
sugar/react/example/panels/Input.tsx → apps/react-playground/src/panels/Input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 5 additions & 1 deletion
6
sugar/react/example/panels/RadioGroup.tsx → ...eact-playground/src/panels/RadioGroup.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
sugar/react/example/panels/SideBySide.tsx → ...eact-playground/src/panels/SideBySide.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
sugar/react/example/panels/TextArea.tsx → .../react-playground/src/panels/TextArea.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.react.json", | ||
"include": ["example", "src", "types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import react from "@vitejs/plugin-react"; | ||
import { defineConfig } from "vite"; | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
extends: ["@singlestone/eslint-config-sugar"], | ||
settings: { | ||
react: { | ||
version: "999.999.999", | ||
}, | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
1b93164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sugar-react – ./apps/react-playground
sugar-react.vercel.app
sugar-react-git-main-singlestone.vercel.app
sugar-react-singlestone.vercel.app
1b93164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sugar-storybook – ./apps/storybook
sugar-storybook-singlestone.vercel.app
sugar-storybook-git-main-singlestone.vercel.app
sugar-css.vercel.app
sugar.singlestone.io