Skip to content

Commit

Permalink
wip: new version
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Mar 8, 2023
1 parent 2e5d6b3 commit cc8616c
Show file tree
Hide file tree
Showing 32 changed files with 5,784 additions and 5,979 deletions.
15 changes: 13 additions & 2 deletions demo/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@

import { defineConfig } from 'astro/config';
import icon from 'astro-icon';

// https://astro.build/config
export default defineConfig({});
export default defineConfig({
integrations: [
icon({
include: {
ic: ['*'],
fe: ['*'],
ri: ['*'],
bi: ['*'],
}
})
]
});
13 changes: 5 additions & 8 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev --experimental-static-build",
"start": "astro dev --experimental-static-build",
"build": "astro build --experimental-static-build",
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview"
},
"devDependencies": {
"astro": "^1.0.0-beta.2",
"astro-icon": "0.8.0"
},
"dependencies": {
"heroicons": "^1.0.5"
"astro": "^2.1.0",
"astro-icon": "workspace:*"
}
}
1 change: 1 addition & 0 deletions demo/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="astro/client" />
6 changes: 0 additions & 6 deletions demo/src/icons/custom.ts

This file was deleted.

3 changes: 0 additions & 3 deletions demo/src/icons/heroicons.ts

This file was deleted.

14 changes: 14 additions & 0 deletions demo/src/icons/logos/alpine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions demo/src/icons/logos/deno.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions demo/src/icons/radix.ts

This file was deleted.

123 changes: 58 additions & 65 deletions demo/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,70 +1,63 @@
---
import { Icon } from 'astro-icon';
import { Icon } from "astro-icon/components";
const icon = "adjustment";
---

<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<title>Astro Icon</title>
<style lang="css">
[astro-icon] {
color: blue;
}
[astro-icon="annotation"] {
color: red;
}
[astro-icon="folder"] {
color: green;
}
</style>
</head>

<body>
<h1>Welcome to Astro Icon!</h1>

<p>The <code>Icon</code> component will optimize and inline any SVG file inside of <code>src/icons/</code></p>

<p>Alternatively, see <a href="/sprite">the Sprite method</a>.</p>

<article>
<h2>Local</h2>
<!-- This will inline your SVG directly -->
<Icon size={24} name="adjustment" />
<Icon size={24} name="annotation" />
</article>

<article>
<h2>Custom remote source</h2>
<!-- Pull your icon from a custom remote source -->
<Icon size={24} pack="radix" name="github-logo" />
</article>

<article>
<h2>Custom SVG resolver</h2>
<!-- Pull your icon from a custom remote source -->
<Icon size={24} pack="custom" name="circle" />
</article>

<article>
<h2>Local dependencies</h2>
<!-- Pull your icon from a local dependency -->
<Icon size={24} pack="heroicons" name="arrow-sm-up" />
<Icon size={24} pack="heroicons" name="arrow-sm-right" />
<Icon size={24} pack="heroicons" name="arrow-sm-down" />
<Icon size={24} pack="heroicons" name="arrow-sm-left" />
</article>

<article>
<h2>Automatic icons from service</h2>
<p>If you can find it on <a href="https://icones.js.org/">Icones</a>, you can render it here!</a></p>
<!-- Pull your icon from the default remote service -->
<Icon size={64} pack="ic" name="baseline-account-box" />
<Icon size={64} name="fe:building" />
<Icon size={64} name="ri:aliens-fill" />
</article>
</body>

<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<title>Astro Icon</title>
<style lang="css">
[data-icon] {
color: blue;
}
[data-icon="annotation"] {
color: red;
}
[data-icon="deno"] {
color: green;
}
</style>
</head>

<body>
<h1>Welcome to Astro Icon!</h1>

<p>
The <code>Icon</code> component will optimize and inline any SVG file inside
of <code>src/icons/</code>
</p>

<article>
<h2>Local</h2>
<!-- This will inline your SVG directly -->
<Icon size={24} name="adjustment" />
<Icon size={24} name={icon} />
<Icon size={24} name={icon} />
<Icon size={24} name="annotation" />
<Icon size={24} name="annotation" />
<Icon size={24} name="annotation" />
<Icon size={24} name="deno" />
<Icon name="deno" />
<Icon name="deno" />
</article>

<article>
<h2>Automatic icons from service</h2>
<p>
If you can find it on <a href="https://icones.js.org/">Icones</a>, you
can render it here!
</p>
</article>
<!-- Pull your icon from the default remote service -->
<Icon size={32} name="ic:baseline-account-box" />
<Icon size={64} name="ic:baseline-account-box" />
<Icon size={80} name="ic:baseline-account-box" />

<Icon size={64} name="fe:building" />
<Icon size={64} name="ri:aliens-fill" />
</body>
</html>
46 changes: 22 additions & 24 deletions demo/src/pages/map.astro
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
---
import { Icon } from 'astro-icon';
import { Icon } from "astro-icon/components";
---

<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<title>Astro Icon</title>
<style lang="css">
[data-icon] {
color: blue;
}
[data-icon="annotation"] {
color: red;
}
[data-icon="bi:stars"] {
color: green;
}
</style>
</head>

<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<title>Astro Icon</title>
<style lang="css">
[astro-icon] {
color: blue;
}
[astro-icon="annotation"] {
color: red;
}
[astro-icon="folder"] {
color: green;
}
</style>
</head>

<body>
<h1>Welcome to Astro Icon!</h1>

{[1,2,3].map(() => <Icon name="bi:stars" /> )}
</body>
<body>
<h1>Welcome to Astro Icon!</h1>

{[1, 2, 3].map(() => <Icon name="bi:stars" />)}
</body>
</html>
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"dev": "yarn workspace demo run dev",
"lint": "prettier \"**/*.{js,ts,md,json}\""
},
"workspaces": [
"packages/*",
"demo"
],
"repository": {
"type": "git",
"url": "git+https://github.com/natemoo-re/astro-icon.git"
Expand All @@ -22,7 +18,7 @@
},
"homepage": "https://github.com/natemoo-re/astro-icon#readme",
"volta": {
"node": "16.13.0",
"node": "16.19.1",
"yarn": "1.22.17"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Icon } from './lib/Icon.astro'
1 change: 1 addition & 0 deletions packages/core/components.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Icon } from './lib/Icon.astro'
31 changes: 0 additions & 31 deletions packages/core/index.ts

This file was deleted.

7 changes: 7 additions & 0 deletions packages/core/integration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { AstroIntegration } from 'astro';

export interface AstroIconOptions {
include: Record<string, ['*'] | string[]>
}

export default function icon(opts: AstroIconOptions): AstroIntegration;
Loading

0 comments on commit cc8616c

Please sign in to comment.