mirror of
https://github.com/iconify/iconify.git
synced 2024-11-09 14:50:56 +00:00
Vue 3 demo for web component
This commit is contained in:
parent
f6b5b2da7b
commit
e3022c4707
@ -75,6 +75,7 @@ Directory `iconify-icon-demo` contains demo packages that show usage of `iconify
|
||||
- [Next.js demo](./iconify-icon-demo/nextjs-demo/) - demo for web component with Next.js. Run `npm run dev` to start demo.
|
||||
- [Svelte demo with Vite](./iconify-icon-demo/svelte-demo/) - demo for web component with Svelte using Vite. Run `npm run dev` to start demo.
|
||||
- [SvelteKit demo](./iconify-icon-demo/sveltekit-demo/) - demo for web component with SvelteKit. Run `npm run dev` to start the demo.
|
||||
- [Vue 3 demo](./iconify-icon-demo/vue-demo/) - demo for web component with Vue 3. Run `npm run dev` to start demo.
|
||||
|
||||
### Iconify icon components
|
||||
|
||||
@ -104,6 +105,7 @@ Deprecation status:
|
||||
- SVG Framework: can be replaced with `iconify-icon`.
|
||||
- React component: can be replaced with `iconify-icon` using `@iconify-icon/react` wrapper.
|
||||
- Svelte component: can be replaced with `iconify-icon`, does not require Svelte specific wrapper.
|
||||
- Vue 3 component: can be replaced with `iconify-icon`, does not require Vue specific wrapper.
|
||||
- Ember component: can be replaced with `iconify-icon`, does not require Ember specific wrapper.
|
||||
|
||||
To import web component, just import it once in your script, as per [`iconify-icon` README file](./iconify-icon/icon/README.md).
|
||||
|
@ -1,220 +0,0 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Alignment (components/Alignment.vue)</h1>
|
||||
<div>
|
||||
<p>Icon with correct width/heigh ratio:</p>
|
||||
<Icon icon="demo" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Bad width/height ratio, default alignment (slice = false):</p>
|
||||
<Icon icon="demo" width="2em" height="1em" />
|
||||
<Icon icon="demo" width="1em" height="2em" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Slice:</p>
|
||||
<Icon icon="demo" width="2em" height="1em" :slice="true" />
|
||||
<Icon icon="demo" width="2em" height="1em" align="slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Slice:</p>
|
||||
<Icon icon="demo" width="1em" height="2em" :slice="true" />
|
||||
<Icon icon="demo" width="1em" height="2em" align="slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Left:</p>
|
||||
<Icon icon="demo" width="2em" height="1em" hAlign="left" />
|
||||
<Icon icon="demo" width="2em" height="1em" h-align="left" />
|
||||
<Icon icon="demo" width="2em" height="1em" horizontalAlign="left" />
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontal-align="left"
|
||||
/>
|
||||
<Icon icon="demo" width="2em" height="1em" align="left" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Left with slice:</p>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
hAlign="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
h-align="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontalAlign="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontal-align="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon icon="demo" width="1em" height="2em" align="left,slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Right:</p>
|
||||
<Icon icon="demo" width="2em" height="1em" hAlign="right" />
|
||||
<Icon icon="demo" width="2em" height="1em" h-align="right" />
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontalAlign="right"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontal-align="right"
|
||||
/>
|
||||
<Icon icon="demo" width="2em" height="1em" align="right" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Right with slice:</p>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
hAlign="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
h-align="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontalAlign="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontal-align="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon icon="demo" width="1em" height="2em" align="right,slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Top:</p>
|
||||
<Icon icon="demo" width="1em" height="2em" verticalAlign="top" />
|
||||
<Icon icon="demo" width="1em" height="2em" vertical-align="top" />
|
||||
<Icon icon="demo" width="1em" height="2em" v-bind:v-align="'top'" />
|
||||
<Icon icon="demo" width="1em" height="2em" align="top" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Top with slice:</p>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
verticalAlign="top"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
vertical-align="top"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
v-bind:v-align="'top'"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
align="top"
|
||||
:slice="true"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p>Bottom:</p>
|
||||
<Icon icon="demo" width="1em" height="2em" verticalAlign="bottom" />
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
vertical-align="bottom"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="1em"
|
||||
height="2em"
|
||||
v-bind:v-align="'bottom'"
|
||||
/>
|
||||
<Icon icon="demo" width="1em" height="2em" align="bottom" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Bottom with slice:</p>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
verticalAlign="bottom"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
vertical-align="bottom"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="demo"
|
||||
width="2em"
|
||||
height="1em"
|
||||
v-bind:v-align="'bottom'"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon icon="demo" width="2em" height="1em" align="bottom,slice" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Icon } from '@iconify/vue/dist/offline';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
svg {
|
||||
color: #06a;
|
||||
font-size: 32px;
|
||||
line-height: 1em;
|
||||
margin-right: 8px;
|
||||
box-shadow: 0 0 0 1px #ccc;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>
|
@ -1,261 +0,0 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Alignment (components/Alignment.vue)</h1>
|
||||
<div>
|
||||
<p>Icon with correct width/heigh ratio:</p>
|
||||
<Icon icon="experiment" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Bad width/height ratio, default alignment (slice = false):</p>
|
||||
<Icon icon="experiment" width="2em" height="1em" />
|
||||
<Icon icon="experiment" width="1em" height="2em" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Slice:</p>
|
||||
<Icon icon="experiment" width="2em" height="1em" :slice="true" />
|
||||
<Icon icon="experiment" width="2em" height="1em" align="slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Slice:</p>
|
||||
<Icon icon="experiment" width="1em" height="2em" :slice="true" />
|
||||
<Icon icon="experiment" width="1em" height="2em" align="slice" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Left:</p>
|
||||
<Icon icon="experiment" width="2em" height="1em" hAlign="left" />
|
||||
<Icon icon="experiment" width="2em" height="1em" h-align="left" />
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontalAlign="left"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontal-align="left"
|
||||
/>
|
||||
<Icon icon="experiment" width="2em" height="1em" align="left" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Left with slice:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
hAlign="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
h-align="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontalAlign="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontal-align="left"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
align="left,slice"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p>Right:</p>
|
||||
<Icon icon="experiment" width="2em" height="1em" hAlign="right" />
|
||||
<Icon icon="experiment" width="2em" height="1em" h-align="right" />
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontalAlign="right"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
horizontal-align="right"
|
||||
/>
|
||||
<Icon icon="experiment" width="2em" height="1em" align="right" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Right with slice:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
hAlign="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
h-align="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontalAlign="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
horizontal-align="right"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
align="right,slice"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p>Top:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
verticalAlign="top"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
vertical-align="top"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
v-bind:v-align="'top'"
|
||||
/>
|
||||
<Icon icon="experiment" width="1em" height="2em" align="top" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Top with slice:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
verticalAlign="top"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
vertical-align="top"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
v-bind:v-align="'top'"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
align="top"
|
||||
:slice="true"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p>Bottom:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
verticalAlign="bottom"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
vertical-align="bottom"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="1em"
|
||||
height="2em"
|
||||
v-bind:v-align="'bottom'"
|
||||
/>
|
||||
<Icon icon="experiment" width="1em" height="2em" align="bottom" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Bottom with slice:</p>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
verticalAlign="bottom"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
vertical-align="bottom"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
v-bind:v-align="'bottom'"
|
||||
:slice="true"
|
||||
/>
|
||||
<Icon
|
||||
icon="experiment"
|
||||
width="2em"
|
||||
height="1em"
|
||||
align="bottom,slice"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
import { Icon } from '@iconify/vue2';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
Icon,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
svg {
|
||||
color: #06a;
|
||||
font-size: 32px;
|
||||
line-height: 1em;
|
||||
margin-right: 8px;
|
||||
box-shadow: 0 0 0 1px #ccc;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>
|
4
iconify-icon-demo/vue-demo/.gitignore
vendored
Normal file
4
iconify-icon-demo/vue-demo/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
*.local
|
19
iconify-icon-demo/vue-demo/README.md
Normal file
19
iconify-icon-demo/vue-demo/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# vue-demo
|
||||
|
||||
## Project setup
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
13
iconify-icon-demo/vue-demo/index.html
Normal file
13
iconify-icon-demo/vue-demo/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
1213
iconify-icon-demo/vue-demo/package-lock.json
generated
Normal file
1213
iconify-icon-demo/vue-demo/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
iconify-icon-demo/vue-demo/package.json
Normal file
19
iconify-icon-demo/vue-demo/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@iconify-icon/vue-demo",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.29"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-icons/bx": "^1.1.5",
|
||||
"@iconify-icons/dashicons": "^1.1.1",
|
||||
"@vitejs/plugin-vue": "^2.1.0",
|
||||
"typescript": "^4.6.3",
|
||||
"vite": "^2.7.13"
|
||||
}
|
||||
}
|
BIN
iconify-icon-demo/vue-demo/public/favicon.ico
Normal file
BIN
iconify-icon-demo/vue-demo/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
78
iconify-icon-demo/vue-demo/src/App.vue
Normal file
78
iconify-icon-demo/vue-demo/src/App.vue
Normal file
@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<OfflineUsageDemo />
|
||||
<UsageDemo />
|
||||
|
||||
<section>
|
||||
<h1>Checkbox</h1>
|
||||
<div>
|
||||
<Checkbox
|
||||
:checked="true"
|
||||
text="Checkbox example"
|
||||
hint="(click icon to toggle)"
|
||||
/>
|
||||
<Checkbox
|
||||
:checked="false"
|
||||
text="Another checkbox example"
|
||||
hint="(only clicking icon works to test @click events)"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<InlineDemo />
|
||||
|
||||
<StyleTest />
|
||||
<InlineTest />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { addIcon, addCollection, disableCache } from 'iconify-icon';
|
||||
import bxBarChartAlt from '@iconify-icons/bx/bx-bar-chart-alt';
|
||||
|
||||
import Checkbox from './demo-components/Checkbox.vue';
|
||||
import InlineDemo from './demo-components/Inline.vue';
|
||||
import OfflineUsageDemo from './demo-components/UsageOffline.vue';
|
||||
import UsageDemo from './demo-components/Usage.vue';
|
||||
|
||||
import StyleTest from './test-components/Style.vue';
|
||||
import InlineTest from './test-components/Inline.vue';
|
||||
|
||||
// Disable cache
|
||||
disableCache('all');
|
||||
|
||||
// Add custom icons
|
||||
addIcon('demo', bxBarChartAlt);
|
||||
addIcon('experiment2', {
|
||||
width: 16,
|
||||
height: 16,
|
||||
body: '<g fill="none" stroke-linecap="round" stroke-width="1" stroke="currentColor"><circle cx="8" cy="8" r="7.5" stroke-dasharray="48" stroke-dashoffset="48"><animate id="circle" attributeName="stroke-dashoffset" values="48;0" dur="0.5s" fill="freeze" /></circle><path d="M8 5v3" stroke-width="2" stroke-dasharray="5" stroke-dashoffset="5"><animate attributeName="stroke-dashoffset" values="5;0" dur="0.3s" begin="circle.end+0.1s" fill="freeze" /></path></g><circle cx="8" cy="11" r="1" fill="currentColor" opacity="0"><animate attributeName="opacity" values="0;1" dur="0.2s" begin="circle.end+0.5s" fill="freeze" /></circle>',
|
||||
});
|
||||
|
||||
// Add few mdi-light: icons
|
||||
addCollection({
|
||||
prefix: '',
|
||||
icons: {
|
||||
alert1: {
|
||||
body: '<path d="M10.5 14c4.142 0 7.5 1.567 7.5 3.5V20H3v-2.5c0-1.933 3.358-3.5 7.5-3.5zm6.5 3.5c0-1.38-2.91-2.5-6.5-2.5S4 16.12 4 17.5V19h13v-1.5zM10.5 5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zm0 1a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5zM20 16v-1h1v1h-1zm0-3V7h1v6h-1z" fill="currentColor"/>',
|
||||
},
|
||||
link1: {
|
||||
body: '<path d="M8 13v-1h7v1H8zm7.5-6a5.5 5.5 0 1 1 0 11H13v-1h2.5a4.5 4.5 0 1 0 0-9H13V7h2.5zm-8 11a5.5 5.5 0 1 1 0-11H10v1H7.5a4.5 4.5 0 1 0 0 9H10v1H7.5z" fill="currentColor"/>',
|
||||
},
|
||||
},
|
||||
width: 24,
|
||||
height: 24,
|
||||
});
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Checkbox,
|
||||
InlineDemo,
|
||||
OfflineUsageDemo,
|
||||
UsageDemo,
|
||||
StyleTest,
|
||||
InlineTest,
|
||||
},
|
||||
};
|
||||
</script>
|
BIN
iconify-icon-demo/vue-demo/src/assets/logo.png
Normal file
BIN
iconify-icon-demo/vue-demo/src/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
50
iconify-icon-demo/vue-demo/src/demo-components/Checkbox.vue
Normal file
50
iconify-icon-demo/vue-demo/src/demo-components/Checkbox.vue
Normal file
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="checkbox-container">
|
||||
<span :class="className">
|
||||
<iconify-icon
|
||||
:icon="icon"
|
||||
:mode="isChecked ? 'svg' : 'style'"
|
||||
@click="check"
|
||||
/>{{ text }}
|
||||
</span>
|
||||
<small>{{ hint }}</small>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import checkedIcon from '@iconify-icons/bx/bx-checkbox-checked';
|
||||
import uncheckedIcon from '@iconify-icons/bx/bx-checkbox';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
text: String,
|
||||
hint: String,
|
||||
checked: Boolean,
|
||||
},
|
||||
methods: {
|
||||
check(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.state = !this.isChecked;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
state: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isChecked() {
|
||||
return this.state === null ? this.checked === true : this.state;
|
||||
},
|
||||
className() {
|
||||
return (
|
||||
'checkbox checkbox--' +
|
||||
(this.isChecked ? 'checked' : 'unchecked')
|
||||
);
|
||||
},
|
||||
icon() {
|
||||
return JSON.stringify(this.isChecked ? checkedIcon : uncheckedIcon);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
15
iconify-icon-demo/vue-demo/src/demo-components/Inline.vue
Normal file
15
iconify-icon-demo/vue-demo/src/demo-components/Inline.vue
Normal file
@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<section class="inline-demo">
|
||||
<h1>Inline demo</h1>
|
||||
<div>
|
||||
Block icons (behaving like image):
|
||||
<iconify-icon icon="experiment2" />
|
||||
<iconify-icon icon="experiment2" mode="style" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icons (behaving line text / icon font):
|
||||
<iconify-icon icon="experiment2" inline />
|
||||
<iconify-icon icon="experiment2" inline mode="style" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
14
iconify-icon-demo/vue-demo/src/demo-components/Usage.vue
Normal file
14
iconify-icon-demo/vue-demo/src/demo-components/Usage.vue
Normal file
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<section class="icon-24">
|
||||
<h1>Usage (with API)</h1>
|
||||
<div>
|
||||
Icons referenced by name (rendered as SVG, then as SPAN):
|
||||
<iconify-icon icon="mdi:home" />
|
||||
<iconify-icon icon="mdi:home" mode="style" />
|
||||
</div>
|
||||
<div class="alert">
|
||||
<iconify-icon icon="mdi-light:alert" />Important notice with alert
|
||||
icon!
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<section class="icon-24">
|
||||
<h1>Usage (offline mode)</h1>
|
||||
<div>
|
||||
Icons referenced by name (rendered as SVG, then as SPAN):
|
||||
<iconify-icon icon="demo" /><iconify-icon
|
||||
icon="demo"
|
||||
mode="style"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Icons referenced by object:
|
||||
<iconify-icon v-bind:icon="demoIcon" /><iconify-icon
|
||||
v-bind:icon="demoIcon"
|
||||
mode="style"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
2 icons imported from icon set:
|
||||
<iconify-icon icon="alert1" />
|
||||
<iconify-icon icon="link1" mode="style" />
|
||||
</div>
|
||||
<div class="alert">
|
||||
<iconify-icon :icon="alertIcon" mode="style" />Important notice with
|
||||
alert icon!
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import demoIcon from '@iconify-icons/dashicons/info-outline';
|
||||
import alertIcon from '@iconify-icons/bx/bx-error';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
demoIcon: JSON.stringify(demoIcon),
|
||||
alertIcon: JSON.stringify(alertIcon),
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
135
iconify-icon-demo/vue-demo/src/index.css
Normal file
135
iconify-icon-demo/vue-demo/src/index.css
Normal file
@ -0,0 +1,135 @@
|
||||
#app {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: left;
|
||||
color: #2c3e50;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
section {
|
||||
border-bottom: 1px dotted #ccc;
|
||||
padding: 16px;
|
||||
}
|
||||
section:last-child {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
section:after {
|
||||
content: ' ';
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
h1 {
|
||||
margin: 0 0 16px;
|
||||
padding: 0;
|
||||
font-size: 24px;
|
||||
font-weight: normal;
|
||||
}
|
||||
p {
|
||||
margin: 12px 0 4px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 24px icon */
|
||||
.icon-24 iconify-icon {
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
vertical-align: -0.25em;
|
||||
}
|
||||
|
||||
/* Alert demo */
|
||||
.alert {
|
||||
position: relative;
|
||||
margin: 8px;
|
||||
padding: 16px;
|
||||
padding-left: 48px;
|
||||
background: #ba3329;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.alert + div {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.alert iconify-icon {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
top: 50%;
|
||||
font-size: 24px;
|
||||
line-height: 1em;
|
||||
margin: -0.5em 0 0;
|
||||
}
|
||||
|
||||
/* Checkbox component */
|
||||
.checkbox-container {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
/* cursor: pointer; */
|
||||
/* color: #1769aa; */
|
||||
color: #626262;
|
||||
text-decoration: none;
|
||||
}
|
||||
/* .checkbox:hover {
|
||||
color: #ba3329;
|
||||
text-decoration: underline;
|
||||
} */
|
||||
|
||||
.checkbox iconify-icon {
|
||||
cursor: pointer;
|
||||
margin-right: 4px;
|
||||
color: #afafaf;
|
||||
font-size: 24px;
|
||||
line-height: 1em;
|
||||
vertical-align: -0.25em;
|
||||
}
|
||||
.checkbox iconify-icon:hover {
|
||||
color: #ba3329;
|
||||
}
|
||||
|
||||
.checkbox--checked iconify-icon {
|
||||
color: #327335;
|
||||
}
|
||||
.checkbox:hover iconify-icon {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.checkbox-container small {
|
||||
margin-left: 4px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Inline demo */
|
||||
.inline-demo iconify-icon {
|
||||
color: #06a;
|
||||
margin: 0 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
background: #fff;
|
||||
}
|
||||
.inline-demo div {
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.inline-demo div:before,
|
||||
.inline-demo div:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0;
|
||||
border-top: 1px dashed #506874;
|
||||
opacity: 0.5;
|
||||
z-index: -1;
|
||||
}
|
||||
.inline-demo div:before {
|
||||
bottom: 5px;
|
||||
}
|
||||
.inline-demo div:after {
|
||||
bottom: 7px;
|
||||
border-top-color: #ba3329;
|
||||
}
|
5
iconify-icon-demo/vue-demo/src/main.js
Normal file
5
iconify-icon-demo/vue-demo/src/main.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import './index.css'
|
||||
|
||||
createApp(App).mount('#app')
|
39
iconify-icon-demo/vue-demo/src/test-components/Class.vue
Normal file
39
iconify-icon-demo/vue-demo/src/test-components/Class.vue
Normal file
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Class (components/Class.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<iconify-icon icon="demo" />
|
||||
</div>
|
||||
<div>
|
||||
Red color:
|
||||
<iconify-icon icon="demo" class="red-color" />
|
||||
<iconify-icon icon="demo" :class="redClass" />
|
||||
</div>
|
||||
<div>
|
||||
Red color and 20px:
|
||||
<iconify-icon icon="demo" class="red-color big-icon" />
|
||||
<iconify-icon icon="demo" :class="[redClass, bigIcon]" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
data: () => {
|
||||
return {
|
||||
redClass: 'red-color',
|
||||
bigIcon: 'big-icon',
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.red-color {
|
||||
color: red;
|
||||
}
|
||||
.big-icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
55
iconify-icon-demo/vue-demo/src/test-components/Inline.vue
Normal file
55
iconify-icon-demo/vue-demo/src/test-components/Inline.vue
Normal file
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Inline (components/Inline.vue)</h1>
|
||||
<div>
|
||||
Block icons (behaving like image):
|
||||
<iconify-icon icon="experiment2" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icons (behaving line text / icon font):
|
||||
<iconify-icon icon="experiment2" inline />
|
||||
</div>
|
||||
<div>
|
||||
Using "vertical-align: 0" to override inline attribute:
|
||||
<iconify-icon
|
||||
icon="experiment2"
|
||||
:style="{ verticalAlign: 0 }"
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
iconify-icon {
|
||||
color: #06a;
|
||||
margin-right: 8px;
|
||||
/* box-shadow: 0 0 0 1px #06a inset; */
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
background: #fff;
|
||||
}
|
||||
div {
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
div:before,
|
||||
div:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0;
|
||||
border-top: 1px dashed #506874;
|
||||
opacity: 0.5;
|
||||
z-index: -1;
|
||||
}
|
||||
div:before {
|
||||
bottom: 5px;
|
||||
}
|
||||
div:after {
|
||||
bottom: 7px;
|
||||
border-top-color: #ba3329;
|
||||
}
|
||||
</style>
|
61
iconify-icon-demo/vue-demo/src/test-components/Style.vue
Normal file
61
iconify-icon-demo/vue-demo/src/test-components/Style.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Style (components/Style.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<iconify-icon icon="demo" />
|
||||
</div>
|
||||
<div>
|
||||
Red color:
|
||||
<iconify-icon
|
||||
icon="demo"
|
||||
inline
|
||||
:style="{ color: 'red', verticalAlign: 0 }"
|
||||
/>
|
||||
<iconify-icon
|
||||
icon="demo"
|
||||
inline
|
||||
style="color: red; vertical-align: 0"
|
||||
/>
|
||||
<Icon icon="demo" :style="redIcon" />
|
||||
</div>
|
||||
<div>
|
||||
40px:
|
||||
<iconify-icon icon="demo" height="40" />
|
||||
<iconify-icon icon="demo" width="40" />
|
||||
<iconify-icon
|
||||
icon="demo"
|
||||
inline
|
||||
:style="{ fontSize: '40px', verticalAlign: 0 }"
|
||||
/>
|
||||
<iconify-icon icon="demo" style="font-size: 40px" />
|
||||
<iconify-icon icon="demo" :style="bigIcon" />
|
||||
</div>
|
||||
<div>
|
||||
Red and 40px:
|
||||
<iconify-icon icon="demo" height="40" style="color: red" />
|
||||
<iconify-icon icon="demo" width="40" :style="redIcon" />
|
||||
<iconify-icon
|
||||
icon="demo"
|
||||
:style="{ color: 'red', fontSize: '40px' }"
|
||||
/>
|
||||
<iconify-icon icon="demo" style="color: red; font-size: 40px" />
|
||||
<iconify-icon icon="demo" :style="[bigIcon, redIcon]" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
data: () => {
|
||||
return {
|
||||
redIcon: {
|
||||
color: 'red',
|
||||
},
|
||||
bigIcon: {
|
||||
fontSize: '40px',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
46
iconify-icon-demo/vue-demo/src/test-components/Transform.vue
Normal file
46
iconify-icon-demo/vue-demo/src/test-components/Transform.vue
Normal file
@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Transformations (components/Transform.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<iconify-icon icon="demo" />
|
||||
</div>
|
||||
<div>
|
||||
Flip horizontally:
|
||||
<iconify-icon icon="demo" flip="horizontal" />
|
||||
</div>
|
||||
<div>
|
||||
Flip vertically:
|
||||
<iconify-icon icon="demo" flip="vertical" />
|
||||
</div>
|
||||
<div>
|
||||
Flip horizontally and vertically:
|
||||
<iconify-icon icon="demo" flip="horizontal,vertical" />
|
||||
</div>
|
||||
<div>
|
||||
90° rotation:
|
||||
<iconify-icon icon="demo" rotate="1" />
|
||||
<iconify-icon icon="demo" rotate="90deg" />
|
||||
<iconify-icon icon="demo" rotate="25%" />
|
||||
</div>
|
||||
<div>
|
||||
180° rotation:
|
||||
<iconify-icon icon="demo" rotate="2" />
|
||||
<iconify-icon icon="demo" rotate="180deg" />
|
||||
<iconify-icon icon="demo" rotate="50%" />
|
||||
</div>
|
||||
<div>
|
||||
270° rotation:
|
||||
<iconify-icon icon="demo" rotate="3" />
|
||||
<iconify-icon icon="demo" rotate="270deg" />
|
||||
<iconify-icon icon="demo" rotate="-25%" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
iconify-icon {
|
||||
font-size: 20px;
|
||||
line-height: 1em;
|
||||
}
|
||||
</style>
|
110
iconify-icon-demo/vue-demo/src/test-components/VueAttributes.vue
Normal file
110
iconify-icon-demo/vue-demo/src/test-components/VueAttributes.vue
Normal file
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Vue attributes (components/VueAttributes.vue)</h1>
|
||||
<div>
|
||||
Icon size (2em):
|
||||
<iconify-icon icon="admin-users" height="2em" />
|
||||
</div>
|
||||
<div>
|
||||
Icon style as string (red):
|
||||
<iconify-icon icon="admin-users" style="color: red" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icon with vertical-align style as string (aligned to top):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
style="vertical-align: 0.25em"
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Inline icon with bound style as object (purple, 2em, no alignment):
|
||||
<iconify-icon icon="admin-users" v-bind:style="icon1StyleObj" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icon with bound style as string (purple, 2em, no alignment):
|
||||
<iconify-icon icon="admin-users" v-bind:style="icon1StyleStr" />
|
||||
</div>
|
||||
<div>
|
||||
Combined styles (green, 2em, shadow):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="[boxShadowStyleObj, fontSizeStyleObj2]"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Dynamic style (red / green, shadow):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="[boxShadowStyleObj, dynamicStyleObj]"
|
||||
v-on:click="
|
||||
dynamicStyleObj.color =
|
||||
dynamicStyleObj.color === 'red' ? 'green' : 'red'
|
||||
"
|
||||
/> (click it!)
|
||||
</div>
|
||||
<div>
|
||||
Dynamic style (shadow / color):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="[
|
||||
showShadow ? boxShadowStyleObj : dynamicStyleObj,
|
||||
]"
|
||||
v-on:click="showShadow = !showShadow"
|
||||
/> (click it!)
|
||||
</div>
|
||||
<div>
|
||||
Reference:
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
ref="icon1"
|
||||
@click="logReference"
|
||||
/> (click to log)
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { addIcon } from 'iconify-icon';
|
||||
import adminUsers from '@iconify-icons/dashicons/admin-users';
|
||||
|
||||
addIcon('admin-users', adminUsers);
|
||||
|
||||
export default {
|
||||
data: () => {
|
||||
return {
|
||||
icon: 'admin-users',
|
||||
icon1StyleObj: {
|
||||
fontSize: '2em',
|
||||
color: 'purple',
|
||||
verticalAlign: 0,
|
||||
},
|
||||
icon1StyleStr: 'color: purple; vertical-align: 0; font-size: 2em;',
|
||||
colorStyleStr: 'color: purple',
|
||||
colorStyleObj: {
|
||||
color: 'purple',
|
||||
},
|
||||
fontSizeStyleStr: 'font-size: 2em',
|
||||
fontSizeStyleObj: {
|
||||
fontSize: '2em',
|
||||
},
|
||||
fontSizeStyleObj2: {
|
||||
'font-size': '2em',
|
||||
},
|
||||
boxShadowStyleStr: 'box-shadow: 0 0 2px #000;',
|
||||
boxShadowStyleObj: {
|
||||
boxShadow: '0 0 2px #000',
|
||||
},
|
||||
dynamicStyleObj: {
|
||||
color: 'red',
|
||||
},
|
||||
showShadow: true,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
logReference: function () {
|
||||
console.log('References:', this.$refs);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<iconify-icon icon="customizer" height="20" :style="{ color: 'purple' }" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addIcon } from 'iconify-icon';
|
||||
import adminCustomizer from '@iconify-icons/dashicons/admin-customizer';
|
||||
|
||||
addIcon('customizer', adminCustomizer);
|
||||
</script>
|
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<iconify-icon icon="customizer" height="20" :style="{ color: 'blue' }" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { addIcon } from 'iconify-icon';
|
||||
import adminCustomizer from '@iconify-icons/dashicons/admin-customizer';
|
||||
|
||||
addIcon('customizer', adminCustomizer);
|
||||
</script>
|
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<iconify-icon :icon="icons.chart" height="20" :style="{ color: 'green' }" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import adminCustomizer from '@iconify-icons/dashicons/admin-customizer';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
chart: JSON.stringify(adminCustomizer),
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<iconify-icon :icon="icons.chart" height="20" :style="{ color: 'red' }" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import adminCustomizer from '@iconify-icons/dashicons/admin-customizer';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
chart: JSON.stringify(adminCustomizer),
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
14
iconify-icon-demo/vue-demo/tsconfig.json
Normal file
14
iconify-icon-demo/vue-demo/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"rootDir": "./lib",
|
||||
"outDir": "./src",
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"declaration": false,
|
||||
"sourceMap": false,
|
||||
"strict": false,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
5
iconify-icon-demo/vue-demo/vite.config.js
Normal file
5
iconify-icon-demo/vue-demo/vite.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
module.exports = {
|
||||
plugins: [vue()],
|
||||
};
|
Loading…
Reference in New Issue
Block a user