|
1 |
| -# Astro Starter Kit: Minimal |
| 1 | +<p> |
| 2 | + <a href="https://webcoreui.dev"> |
| 3 | + <img |
| 4 | + alt="Webcore - Frontend components for Astro, Svelte, and React" |
| 5 | + src="https://raw.githubusercontent.com/Frontendland/webcoreui/main/public/img/banner.png" |
| 6 | + /> |
| 7 | + </a> |
| 8 | +</p> |
2 | 9 |
|
3 |
| -```sh |
4 |
| -npm create astro@latest -- --template minimal |
| 10 | +<p> |
| 11 | + <a href="https://github.com/Frontendland/webcoreui/releases"> |
| 12 | + <img |
| 13 | + src="https://img.shields.io/npm/v/webcoreui.svg?label=Latest%20Release" |
| 14 | + alt="Latest Release" |
| 15 | + /> |
| 16 | + </a> |
| 17 | + <a href="https://github.com/Frontendland/webcoreui/blob/main/LICENSE"> |
| 18 | + <img |
| 19 | + src="https://img.shields.io/badge/license-MIT-blue" |
| 20 | + alt="License" |
| 21 | + /> |
| 22 | + </a> |
| 23 | +</p> |
| 24 | + |
| 25 | +--- |
| 26 | +## Table of Contents |
| 27 | + |
| 28 | +- [Table of Contents](#table-of-contents) |
| 29 | +- [Documentation](#documentation) |
| 30 | +- [Getting started](#getting-started) |
| 31 | + - [Prerequisites](#prerequisites) |
| 32 | + - [Installation](#installation) |
| 33 | + - [Setup](#setup) |
| 34 | + - [Using Components](#using-components) |
| 35 | + |
| 36 | +## Documentation |
| 37 | + |
| 38 | +Full documentation coming soon on [webcoreui.dev/docs](https://webcoreui.dev/docs). |
| 39 | + |
| 40 | +## Getting Started |
| 41 | + |
| 42 | +Webcore can be used as a standalone project, or it can be integrated into your existing Astro, Svelte, or React ecosystems. |
| 43 | + |
| 44 | +### Prerequisites |
| 45 | + |
| 46 | +> [!NOTE] |
| 47 | +> Before getting started, make sure you have a package manager installed, such as <a href="https://nodejs.org/en/" rel="noreferrer">Node</a>. |
| 48 | +
|
| 49 | +Webcore components use Sass for styling. To use the component library, you must have the following packages installed: |
| 50 | + |
| 51 | +- [Sass](https://www.npmjs.com/package/sass) - `v1.77` and above |
| 52 | +- [TypeScript](https://www.npmjs.com/package/typescript) - `v5.4` and above |
| 53 | + |
| 54 | +Depending on your project setup, you'll also need the following packages: |
| 55 | + |
| 56 | +- **For Astro projects** |
| 57 | + - [Astro](https://www.npmjs.com/package/astro) - `v4.10` and above |
| 58 | +- **For Svelte projects** |
| 59 | + - [Svelte](https://www.npmjs.com/package/svelte) - `v4.2` and above |
| 60 | +- **For React projects** |
| 61 | + - [React](https://www.npmjs.com/package/react) - `v18.3` and above |
| 62 | + - [React DOM](https://www.npmjs.com/package/react-dom) -`v18.3` and above |
| 63 | + |
| 64 | +### Installation |
| 65 | + |
| 66 | +Install Webcore as a dependency by running one of the following command: |
| 67 | + |
| 68 | +```bash |
| 69 | +# Using NPM |
| 70 | +npm i webcoreui |
| 71 | + |
| 72 | +# Using Yarn |
| 73 | +yarn add webcoreui |
5 | 74 | ```
|
6 | 75 |
|
7 |
| -[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal) |
8 |
| -[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/minimal) |
9 |
| -[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/minimal/devcontainer.json) |
| 76 | +### Setup |
10 | 77 |
|
11 |
| -> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! |
| 78 | +1. Add the following to your `tsconfig.json` to include TypeScript types: |
12 | 79 |
|
13 |
| -## 🚀 Project Structure |
| 80 | +```json |
| 81 | +{ |
| 82 | + "include": ["webcoreui"] |
| 83 | +} |
| 84 | +``` |
14 | 85 |
|
15 |
| -Inside of your Astro project, you'll see the following folders and files: |
| 86 | +2. Setup default styles and fonts by calling the following in your global SCSS file: |
16 | 87 |
|
17 |
| -```text |
18 |
| -/ |
19 |
| -├── public/ |
20 |
| -├── src/ |
21 |
| -│ └── pages/ |
22 |
| -│ └── index.astro |
23 |
| -└── package.json |
| 88 | +```scss |
| 89 | +@import 'webcoreui/styles'; |
| 90 | +@include Setup(( |
| 91 | + // Define paths for your fonts |
| 92 | + fontRegular: '/fonts/Inter-Regular.woff2', |
| 93 | + fontBold: '/fonts/Inter-Bold.woff2' |
| 94 | +)); |
24 | 95 | ```
|
25 | 96 |
|
26 |
| -Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. |
| 97 | +> [!TIP] |
| 98 | +> You can download the fonts Webcore uses from the [`public/fonts`](https://github.com/Frontendland/webcoreui/tree/main/public/fonts) directory. |
| 99 | +
|
| 100 | +The `Setup` mixin can also accept the following options: |
27 | 101 |
|
28 |
| -There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. |
29 | 102 |
|
30 |
| -Any static assets, like images, can be placed in the `public/` directory. |
| 103 | +| Property | Default value | Purpose | | | |
| 104 | +|-----------|----------------|----------|---|---| |
| 105 | +| `includeResets` | `true` | Include reset styles. Set to `false` if you want to use your own CSS resets. | |
| 106 | +| `includeHelperClasses` | `true` | Adds global helper classes for CSS. All global helper classes are defined [here](https://github.com/Frontendland/webcoreui/tree/main/src/scss/global). | |
31 | 107 |
|
32 |
| -## 🧞 Commands |
| 108 | +### Using Components |
33 | 109 |
|
34 |
| -All commands are run from the root of the project, from a terminal: |
| 110 | +Start using Webcore components in your code by importing them: |
35 | 111 |
|
36 |
| -| Command | Action | |
37 |
| -| :------------------------ | :----------------------------------------------- | |
38 |
| -| `npm install` | Installs dependencies | |
39 |
| -| `npm run dev` | Starts local dev server at `localhost:4321` | |
40 |
| -| `npm run build` | Build your production site to `./dist/` | |
41 |
| -| `npm run preview` | Preview your build locally, before deploying | |
42 |
| -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | |
43 |
| -| `npm run astro -- --help` | Get help using the Astro CLI | |
| 112 | +```astro |
| 113 | +--- |
| 114 | +// Import the component relevant to your project |
| 115 | +// How to import Astro components |
| 116 | +import { Accordion } from 'webcoreui/astro' |
44 | 117 |
|
45 |
| -## 👀 Want to learn more? |
| 118 | +// How to import Svelte components |
| 119 | +import { Accordion } from 'webcoreui/svelte' |
46 | 120 |
|
47 |
| -Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). |
| 121 | +// How to import React components |
| 122 | +import { Accordion } from 'webcoreui/react' |
| 123 | +--- |
| 124 | +
|
| 125 | +<Accordion items={[{ ... }]} /> |
| 126 | +``` |
0 commit comments