Skip to content

Commit

Permalink
init astro-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Bean.Wei committed Nov 21, 2024
0 parents commit 53b5bd4
Show file tree
Hide file tree
Showing 38 changed files with 6,501 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# http://editorconfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# 2 space indentation
[*.{vue,astro,ts,tsx,js,mjs,json,y{a,}ml,html,cwl}]
indent_style = space
indent_size = 2

[*.{md,Rmd,rst,mdx}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage
coverage

# production
/build
dist/

# misc
.cache
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.production

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn-integrity
.idea
.now
dist
esm

.vercel


# Astro
.astro/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore-workspace-root-check=true
shell-emulator=true
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"tailwindCSS.experimental.classRegex": [
["([\"'`][^\"'`]*.*?[\"'`])", "[\"'`]([^\"'`]*).*?[\"'`]"]
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Bean Wei <https://github.com/beanwei>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p align="center">
<h1 align="center">astro-ui</h1>
</p>
65 changes: 65 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 100,
"lineEnding": "lf",
"formatWithErrors": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off"
}
}
},
"javascript": {
"formatter": {
"trailingCommas": "es5",
"quoteStyle": "single",
"semicolons": "asNeeded"
}
},
"json": {
"parser": {
"allowComments": true,
"allowTrailingCommas": true
},
"formatter": {
"indentStyle": "space",
"trailingCommas": "none"
}
},
"overrides": [
{
"include": ["package.json"],
"json": {
"formatter": {
"lineWidth": 1
}
}
},
{
"include": ["*.astro"],
"linter": {
"rules": {
"style": {
"useConst": "off",
"useImportType": "off"
}
}
}
}
],
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
37 changes: 37 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import starlight from '@astrojs/starlight'
import tailwind from '@astrojs/tailwind'
import { defineConfig } from 'astro/config'

import icon from 'astro-icon'

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: 'AstroUI',
social: {
github: 'https://github.com/beanwei/astro-ui',
},
sidebar: [
{
label: 'Guides',
items: [
{ label: 'Introduction', slug: 'guides/introduction' },
{ label: 'Installation', slug: 'guides/installation' },
],
},
{
label: 'Components',
autogenerate: { directory: 'components' },
},
],
customCss: ['./src/custom.css'],
}),
tailwind({ applyBaseStyles: false }),
icon({
include: {
lucide: ['chevron-right', 'mail-open'],
},
}),
],
})
23 changes: 23 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.29.2",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/tailwind": "^5.1.2",
"@beanwei/astro-ui": "workspace:*",
"@iconify-json/lucide": "^1.2.15",
"astro": "^4.16.13",
"astro-icon": "^1.1.2",
"tailwindcss": "^3.4.15",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-scoped-preflight": "^3.4.9",
"vite-plugin-simple-scope": "^2.0.2"
}
}
1 change: 1 addition & 0 deletions docs/public/favicon.svg
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 docs/src/assets/houston.webp
Binary file not shown.
16 changes: 16 additions & 0 deletions docs/src/components/Preview.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
import { TabItem, Tabs } from '@astrojs/starlight/components'
// https://github.com/withastro/roadmap/discussions/827
---

<Tabs>
<TabItem label="Preview">
<div class="not-content ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 relative rounded-md border p-10 flex flex-wrap gap-4">
<slot name="preview" />
</div>
</TabItem>
<TabItem label="Code">
<slot />
</TabItem>
</Tabs>
6 changes: 6 additions & 0 deletions docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineCollection } from 'astro:content'
import { docsSchema } from '@astrojs/starlight/schema'

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
}
108 changes: 108 additions & 0 deletions docs/src/content/docs/components/button.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: Button
description: button
---

import Preview from '~/components/Preview.astro'
import { Button } from '@beanwei/astro-ui'
import { Icon } from 'astro-icon/components'

## Import

```tsx
import { Button } from '@beanwei/astro-ui'
```

## Usage

<Preview>
<Fragment slot="preview">
<Button>Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
</Fragment>
```tsx
---
import { Button } from '@beanwei/astro-ui'
---

<Button>Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
```
</Preview>


### Icon

<Preview>
<Fragment slot="preview">
<Button variant="outline" size="icon">
<Icon name="lucide:chevron-right" />
</Button>
<Button>
<Icon name="lucide:mail-open" />
Login with Email
</Button>
</Fragment>
```tsx
---
import { Button } from '@beanwei/astro-ui'
import { Icon } from 'astro-icon/components'
---

<Button variant="outline" size="icon">
<Icon name="lucide:chevron-right" />
</Button>
<Button>
<Icon name="lucide:mail-open" />
Login with Email
</Button>
```
</Preview>


### Loading

<Preview>
<Fragment slot="preview">
<Button data-state="loading" disabled>
Please wait
</Button>
</Fragment>
```tsx
---
import { Button } from '@beanwei/astro-ui'
---

<Button data-state="loading" disabled>
Please wait
</Button>
```
</Preview>


### As Child

<Preview>
<Fragment slot="preview">
<Button asChild>
<a href="/">Home</a>
</Button>
</Fragment>
```tsx
---
import { Button } from '@beanwei/astro-ui'
---

<Button asChild>
<a href="/">Home</a>
</Button>
```
</Preview>
Loading

0 comments on commit 53b5bd4

Please sign in to comment.