docs(apps,packages): update content (#93)

* docs(apps,packages): update content

* chore: update pull request template
This commit is contained in:
Ayo Ayco 2022-10-16 10:26:20 +02:00 committed by GitHub
parent 36742b7239
commit 5e1a44c79e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 112 additions and 279 deletions

View file

@ -1,7 +1,10 @@
type(scope): description
# type(scope): description
<!--
☝️ Put your PR title up here!
✨ Example PR titles:
feat(form): implement new FormControl isValid state
fix(validator): correct the variable name typo causing errors
docs(library): update project CONTRIBUTING.md
-->
@ -16,5 +19,6 @@ Tag a reviewer: @
Tasks:
- [ ] I have ran the tests to make sure nothing is broken (see CONTRIBUTING.md)
- [ ] I have ran the the linter to make sure code is clean (see CONTRIBUTING.md)
- [ ] I have reviewed my own code to remove changes that are not needed
<!-- THANK YOU FOR THE CONTRIBUTION! 🚀 -->

View file

@ -61,6 +61,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
ayo@ayco.io.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the

View file

@ -26,11 +26,16 @@ This project aims to be a library that developers will use to create reactive UI
Currently, it is made up of [NPM workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces), which are node projects that share a singular root package. It is good to understand the basics of this, but basically, the project will have multiple packages (under the `packages` directory) that share a common root package information.
Packages:
1. [demo](https://github.com/ayoayco/astro-reactive-library/tree/main/demo#readme) - found in the directory `demo`
- the demo Astro app that we use to test and demonstrate the library features
2. [form](https://github.com/ayoayco/astro-reactive-library/tree/main/packages/form#readme) - found in the directory `packages/form`
- allows developers to programatically build a Form for Astro
3. [astro-reactive-validator](https://github.com/ayoayco/astro-reactive-library/tree/main/packages/astro-reactive-validator) - found in the directory `packages/astro-reactive-validator`
1. [demo](https://github.com/ayoayco/astro-reactive-library/tree/main/apps/demo) in the directory `apps/demo`
- Astro web application that we use to test and demonstrate the library components
1. [form](https://github.com/ayoayco/astro-reactive-library/tree/main/packages/form) in the directory `packages/form`
- component that allows developers to programmatically build a form
1. [validator](https://github.com/ayoayco/astro-reactive-library/tree/main/packages/validator) in the directory `packages/astro-reactive-validator`
- component that allows developers to set up validators for their forms easily
1. [docs](https://github.com/ayoayco/astro-reactive-library/tree/main/apps/docs) - in the directory `apps/docs`
- Astro website for the library's extensive documentation
1. [landing-page](https://github.com/ayoayco/astro-reactive-library/tree/main/apps/landing-page) - in the directory `apps/landing-page`
- Astro website for the library's introductory landing page
# Running locally
@ -67,15 +72,21 @@ https://localhost:3000
```
# The Documentation website
# Applications
Want to update the documentation? We also maintain the documentation website in this repository. The source for this is found in the `docs` directory. You can also start the dev server for the docs website with the following command:
We also maintain the documentation website and the project landing page in this repository. The source for these applications is found in the `apps` directory.
You can start the dev server for the docs and landing-page websites with the following commands:
```
npm run docs
```
```
npm run landing-page
```
# Running the linter and tests
Please run the linter and tests before creating a PR to avoid delays in PR reviews. Fix all linting errors or failing tests whey you run the following commands.
@ -88,7 +99,7 @@ npm run lint
npm test
```
✨ _HINT: Some linting errors could automatically fixed with a command_
✨ _HINT: Some linting errors could be automatically fixed with a command_
```
npm run lint:fix
@ -96,7 +107,7 @@ npm run lint:fix
# Hacking with the packages
As mentioned above, this project involves packages that are intened to be used in Astro applications. The demo app is our way to test and play with the packages.
As mentioned above, this project involves packages that are intended to be used in Astro applications. The demo app is our way to test and play with the packages.
If you plan to add features or fix bugs that are found in the packages, such as `@astro-reactive/form`, you can find the source code for this inside the `packages` directory.

View file

@ -17,9 +17,9 @@
| Packages | Version | Description |
| --- | --- | --- |
| [@astro-reactive/form](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/form/README.md) | [![npm](https://img.shields.io/npm/v/@astro-reactive/form)](https://www.npmjs.com/package/@astro-reactive/form) | generate a dynamic form which can be modified programatically |
| [@astro-reactive/form](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/form/README.md) | [![npm](https://img.shields.io/npm/v/@astro-reactive/form)](https://www.npmjs.com/package/@astro-reactive/form) | generate a dynamic form which can be modified programmatically |
| [@astro-reactive/validator](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/validator/README.md)| [![npm](https://img.shields.io/npm/v/@astro-reactive/validator)](https://www.npmjs.com/package/@astro-reactive/validator) | set up validators for your form easily |
| astro-reactive-datagrid | 🛠 | generate a dynamic datagrid or table of values |
| @astro-reactive/data-grid | 🛠 | generate a dynamic data grid of values |
# HACKTOBERFEST 2022
@ -75,10 +75,22 @@ https://localhost:3000
npm test
```
_[Please report issues and suggestions](https://github.com/ayoayco/astro-reactive-library/issues)_
## Other apps
We also maintain the docs website and the project landing page in this repository. Run the following to start the dev servers:
```
npm run docs
```
```
npm run landing-page
```
# Contributors
This project is only possible because of the support and contribution of our community ❤️
<a href="https://github.com/ayoayco/astro-reactive-library/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ayoayco/astro-reactive-library" />
</a>

View file

@ -1,6 +1,7 @@
# Demo App for Astro Reactive Form 🔥
![Astro Reactive Library](https://user-images.githubusercontent.com/4262489/193419437-6e437743-47bf-482b-8f7e-de3c7f5285f8.png)
To start the app:
# Demo App for Astro Reactive Library
1. `npm i`
1. `npm start`
Start the dev server by running: `npm start`
👉 _[Join our contributors!](https://github.com/ayoayco/astro-reactive-library/blob/main/CONTRIBUTING.md)_

View file

@ -1,173 +1,7 @@
# Astro Starter Kit: Docs Site
![Astro Reactive Library](https://user-images.githubusercontent.com/4262489/193419437-6e437743-47bf-482b-8f7e-de3c7f5285f8.png)
```bash
npm create astro@latest -- --template docs
```
# Documentation Website
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/docs)
Start the dev server by running: `npm run docs`
![docs](https://user-images.githubusercontent.com/4677417/186189283-0831b9ab-d6b9-485d-8955-3057e532ab31.png)
## Features
- ✅ **Full Markdown support**
- ✅ **Responsive mobile-friendly design**
- ✅ **Sidebar navigation**
- ✅ **Search (powered by Algolia)**
- ✅ **Multi-language i18n**
- ✅ **Automatic table of contents**
- ✅ **Automatic list of contributors**
- ✅ (and, best of all) **dark mode**
## Commands Cheatsheet
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :--------------------- | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro --help` | Get help using the Astro CLI |
To deploy your site to production, check out our [Deploy an Astro Website](https://docs.astro.build/guides/deploy) guide.
## New to Astro?
Welcome! Check out [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
## Customize This Theme
### Site metadata
`src/config.ts` contains several data objects that describe metadata about your site like title, description, default language, and Open Graph details. You can customize these to match your project.
### CSS styling
The theme's look and feel is controlled by a few key variables that you can customize yourself. You'll find them in the `src/styles/theme.css` CSS file.
If you've never worked with CSS variables before, give [MDN's guide on CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) a quick read.
This theme uses a "cool blue" accent color by default. To customize this for your project, change the `--theme-accent` variable to whatever color you'd like:
```diff
/* src/styles/theme.css */
:root {
color-scheme: light;
- --theme-accent: hsla(var(--color-blue), 1);
+ --theme-accent: hsla(var(--color-red), 1); /* or: hsla(#FF0000, 1); */
```
## Page metadata
Astro uses frontmatter in Markdown pages to choose layouts and pass properties to those layouts. If you are using the default layout, you can customize the page in many different ways to optimize SEO and other things. For example, you can use the `title` and `description` properties to set the document title, meta title, meta description, and Open Graph description.
```markdown
---
title: Example title
description: Really cool docs example that uses Astro
layout: ../../layouts/MainLayout.astro
---
# Page content...
```
For more SEO related properties, look at `src/components/HeadSEO.astro`
### Sidebar navigation
The sidebar navigation is controlled by the `SIDEBAR` variable in your `src/config.ts` file. You can customize the sidebar by modifying this object. A default, starter navigation has already been created for you.
```ts
export const SIDEBAR = {
en: [
{ text: "Section Header", header: true },
{ text: "Introduction", link: "en/introduction" },
{ text: "Page 2", link: "en/page-2" },
{ text: "Page 3", link: "en/page-3" },
{ text: "Another Section", header: true },
{ text: "Page 4", link: "en/page-4" },
],
};
```
Note the top-level `en` key: This is needed for multi-language support. You can change it to whatever language you'd like, or add new languages as you go. More details on this below.
### Multiple Languages support
The Astro docs template supports multiple langauges out of the box. The default theme only shows `en` documentation, but you can enable multi-language support features by adding a second language to your project.
To add a new language to your project, you'll want to extend the current `src/pages/[lang]/...` layout:
```diff
📂 src/pages
┣ 📂 en
┃ ┣ 📜 page-1.md
┃ ┣ 📜 page-2.md
┃ ┣ 📜 page-3.astro
+ ┣ 📂 es
+ ┃ ┣ 📜 page-1.md
+ ┃ ┣ 📜 page-2.md
+ ┃ ┣ 📜 page-3.astro
```
You'll also need to add the new language name to the `KNOWN_LANGUAGES` map in your `src/config.ts` file. This will enable your new language switcher in the site header.
```diff
// src/config.ts
export const KNOWN_LANGUAGES = {
English: 'en',
+ Spanish: 'es',
};
```
Last step: you'll need to add a new entry to your sidebar, to create the table of contents for that language. While duplicating every page might not sound ideal to everyone, this extra control allows you to create entirely custom content for every language.
> Make sure the sidebar `link` value points to the correct language!
```diff
// src/config.ts
export const SIDEBAR = {
en: [
{ text: 'Section Header', header: true, },
{ text: 'Introduction', link: 'en/introduction' },
// ...
],
+ es: [
+ { text: 'Encabezado de sección', header: true, },
+ { text: 'Introducción', link: 'es/introduction' },
+ // ...
+ ],
};
// ...
```
If you plan to use Spanish as the the default language, you just need to modify the redirect path in `src/pages/index.astro`:
```diff
<script>
- window.location.pathname = `/en/introduction`;
+ window.location.pathname = `/es/introduction`;
</script>
```
You can also remove the above script and write a landing page in Spanish instead.
### What if I don't plan to support multiple languages?
That's totally fine! Not all projects need (or can support) multiple languages. You can continue to use this theme without ever adding a second language.
If that single language is not English, you can just replace `en` in directory layouts and configurations with the preferred language.
### Search (Powered by Algolia)
[Algolia](https://www.algolia.com/) offers a free service to qualified open source projects called [DocSearch](https://docsearch.algolia.com/). If you are accepted to the DocSearch program, provide your API Key & index name in `src/config.ts` and a search box will automatically appear in your site header.
Note that Aglolia and Astro are not affiliated. We have no say over acceptance to the DocSearch program.
If you'd prefer to remove Algolia's search and replace it with your own, check out the `src/components/Header.astro` component to see where the component is added.
👉 _[Join our contributors!](https://github.com/ayoayco/astro-reactive-library/blob/main/CONTRIBUTING.md)_

View file

@ -6,6 +6,7 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"docs": "astro dev",
"check": "astro check && tsc",
"build": "astro build",
"preview": "astro preview",

View file

@ -1,49 +1,7 @@
# Welcome to [Astro](https://astro.build)
![Astro Reactive Library](https://user-images.githubusercontent.com/4262489/193419437-6e437743-47bf-482b-8f7e-de3c7f5285f8.png)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
# Landing Page
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
Start the dev server by running: `npm run landing-page`
![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png)
## 🚀 Project Structure
Inside of your Astro project, you'll see the following folders and files:
```
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
```
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the `public/` directory.
## 🧞 Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :--------------------- | :------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `npm run astro --help` | Get help using the Astro CLI |
## 👀 Want to learn more?
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
👉 _[Join our contributors!](https://github.com/ayoayco/astro-reactive-library/blob/main/CONTRIBUTING.md)_

View file

@ -5,6 +5,7 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"landing-page": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",

View file

@ -2,13 +2,21 @@
<img src="https://raw.githubusercontent.com/ayoayco/astro-reactive-library/main/.github/assets/logo/min-banner.png" alt="Astro Reactive Library Logo">
<strong>Astro Reactive Form</strong>
<br />
Generate a dynamic form based on your data, and modify programatically.
Generate a dynamic form based on your data, and modify programmatically.
<br />
<br />
<img src="https://img.shields.io/npm/v/@astro-reactive/form" />
<img src="https://img.shields.io/npm/l/@astro-reactive/form" />
<img src="https://img.shields.io/npm/dt/@astro-reactive/form" />
<img src="https://img.shields.io/librariesio/release/npm/@astro-reactive/form" />
<a href="https://www.npmjs.com/package/@astro-reactive/form">
<img src="https://img.shields.io/npm/v/@astro-reactive/form" alt="Package information: NPM version" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/form">
<img src="https://img.shields.io/npm/l/@astro-reactive/form" alt="Package information: NPM license" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/form">
<img src="https://img.shields.io/npm/dt/@astro-reactive/form" alt="Package information: NPM downloads" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/form">
<img src="https://img.shields.io/librariesio/release/npm/@astro-reactive/form" alt="Package information: NPM dependencies status" />
</a>
<br />
<br />
</p>
@ -61,11 +69,6 @@ userNameControl?.setValue("RAMOOOON");
form.get('is-awesome')?.setValue("checked");
---
<!--
the `formGroups` attribute can take a single FormGroup
or an array of FormGroup for multiple fieldsets;
we do a single for now in this example
-->
<Form
formGroups={form}
submitControl={{
@ -73,6 +76,12 @@ form.get('is-awesome')?.setValue("checked");
name: "submit",
}}
/>
<!--
The `formGroups` attribute can take a single FormGroup
or an array of FormGroup for multiple fieldset blocks;
we are using a single FormGroup for now in this example.
-->
<
```
# Screenshots
@ -86,24 +95,11 @@ Example of multiple form groups:
# Validation
See our [package for setting up validators](https://www.npmjs.com/package/@astro-reactive/validator).
This Form component is designed to work with [Astro Reactive Validator](https://www.npmjs.com/package/@astro-reactive/validator), our package for setting up validators easily.
# Future Plans
# We are opensource!
Currently this only supports very basic form creation, but the goal of the project is ambitious:
1. Themes - unstyled, light mode, dark mode, compact, large
1. FormGroup class
1. `statusChanges` - observable that emits the form status when it changes
1. `valueChanges` - observable that emits the values of all controls when they change
1. FormControl class
1. `statusChanges` - observable that emits the control status when it changes
1. `valueChanges` - observable that emits the control value when it changes
1. Documentation website
👉 _All [contributions](https://github.com/ayoayco/astro-reactive-library/blob/main/CONTRIBUTING.md) are welcome. Let's make the fastest web forms powered by Astro._
... and so much more
_All contributions are welcome. Let's make the fastest web form component powered by Astro_
# Older Versions
Older versions can be found [here](https://www.npmjs.com/package/astro-reactive-form).
👉 _This package is under rigorous development. See the [change log](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/form/RELEASE.md)._

View file

@ -5,10 +5,18 @@
Set up validators for your forms easily.
<br />
<br />
<img src="https://img.shields.io/npm/v/@astro-reactive/validator" />
<img src="https://img.shields.io/npm/l/@astro-reactive/validator" />
<img src="https://img.shields.io/npm/dt/@astro-reactive/validator" />
<img src="https://img.shields.io/librariesio/release/npm/@astro-reactive/validator" />
<a href="https://www.npmjs.com/package/@astro-reactive/validator">
<img src="https://img.shields.io/npm/v/@astro-reactive/validator" alt="Package information: NPM version" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/validator">
<img src="https://img.shields.io/npm/l/@astro-reactive/validator" alt="Package information: NPM license" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/validator">
<img src="https://img.shields.io/npm/dt/@astro-reactive/validator" alt="Package information: NPM downloads" />
</a>
<a href="https://www.npmjs.com/package/@astro-reactive/validator">
<img src="https://img.shields.io/librariesio/release/npm/@astro-reactive/validator" alt="Package information: NPM dependencies status" />
</a>
<br />
<br />
</p>
@ -47,9 +55,6 @@ const form = new FormGroup([
},
]);
// set the name optionally
form.name = "Simple Form";
// you can insert a control at any point
form.controls.push(
new FormControl({
@ -60,20 +65,19 @@ form.controls.push(
})
);
// you can get a FormControl object
const userNameControl = form.get("username");
// you can set values dynamically
userNameControl?.setValue("RAMOOOON");
form.get('is-awesome')?.setValue("checked");
---
<!--
the `formGroups` attribute can take a single FormGroup
or an array of FormGroup for multiple fieldsets;
we do a single for now in this example
-->
<Form showValidationHints={true} formGroups={form} />
<!--
The `showValidationHints` attribute tells the Form component
that you want to render validation hints. So far, these are:
1. asterisks on required controls' labels
2. controls with errors will become color red
This property is optional and set to false by default,
which keeps the Form component unstyled,
and gives you have the freedom to style it yourself.
-->
```
# Screenshots
@ -88,3 +92,13 @@ form.get('is-awesome')?.setValue("checked");
1. `Validators.email` - checks if value is a valid email
1. `Validators.minLength(limit)` - checks if value length is greater than or equal to limit
1. `Validators.maxLength(limit)` - checks if value length is less than or equal to limit
# Form component
This validation library is designed to work with [Astro Reactive Form](https://www.npmjs.com/package/@astro-reactive/form), our package for generating dynamic forms.
# We are opensource!
👉 _All [contributions](https://github.com/ayoayco/astro-reactive-library/blob/main/CONTRIBUTING.md) are welcome. Let's make the validation library for Astro._
👉 _This package is under rigorous development. See the [change log](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/validator/RELEASE.md)_.

View file

@ -1,5 +1,5 @@
## 0.0.3
- udpate examples on the README
- update examples on the README
## 0.0.1
- Validators