mirror of
https://github.com/iconify/iconify.git
synced 2024-12-22 09:48:54 +00:00
Vue 2 demo for web component
This commit is contained in:
parent
e3022c4707
commit
20494a834d
@ -76,6 +76,7 @@ Directory `iconify-icon-demo` contains demo packages that show usage of `iconify
|
||||
- [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.
|
||||
- [Vue 2 demo](./iconify-icon-demo/vue2-demo/) - demo for web component with Vue 2. Run `npm run build` to build demo and `npm run serve` to start it.
|
||||
|
||||
### Iconify icon components
|
||||
|
||||
@ -106,6 +107,7 @@ Deprecation status:
|
||||
- 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.
|
||||
- Vue 3 component: can be replaced with `iconify-icon`, does not require Vue specific wrapper. Make sure you are not using Webpack older than version 5.
|
||||
- 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).
|
||||
|
2
iconify-icon-demo/vue2-demo/.browserslistrc
Normal file
2
iconify-icon-demo/vue2-demo/.browserslistrc
Normal file
@ -0,0 +1,2 @@
|
||||
> 1%
|
||||
last 2 versions
|
24
iconify-icon-demo/vue2-demo/.gitignore
vendored
Normal file
24
iconify-icon-demo/vue2-demo/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Vue 2 repo is outdated, hiding from repo to avoid Dependabot alerts
|
||||
package-lock.json
|
24
iconify-icon-demo/vue2-demo/README.md
Normal file
24
iconify-icon-demo/vue2-demo/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# vue-demo
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
3
iconify-icon-demo/vue2-demo/babel.config.js
Normal file
3
iconify-icon-demo/vue2-demo/babel.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ["@vue/cli-plugin-babel/preset"]
|
||||
};
|
26
iconify-icon-demo/vue2-demo/package.json
Normal file
26
iconify-icon-demo/vue2-demo/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@iconify-icon/vue2-demo",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^2.6.14",
|
||||
"vue-class-component": "^7.2.6",
|
||||
"vue-property-decorator": "^9.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-icons/bx": "^1.1.5",
|
||||
"@iconify-icons/dashicons": "^1.1.1",
|
||||
"@vue/cli-plugin-babel": "^5.0.4",
|
||||
"@vue/cli-plugin-typescript": "^5.0.4",
|
||||
"@vue/cli-service": "^5.0.4",
|
||||
"@vue/eslint-config-typescript": "^10.0.0",
|
||||
"core-js": "^3.21.1",
|
||||
"typescript": "^4.6.3",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"webpack": "^5.72.1"
|
||||
}
|
||||
}
|
BIN
iconify-icon-demo/vue2-demo/public/favicon.ico
Normal file
BIN
iconify-icon-demo/vue2-demo/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
iconify-icon-demo/vue2-demo/public/index.html
Normal file
17
iconify-icon-demo/vue2-demo/public/index.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
206
iconify-icon-demo/vue2-demo/src/App.vue
Normal file
206
iconify-icon-demo/vue2-demo/src/App.vue
Normal file
@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<OfflineUsageDemo />
|
||||
<UsageDemo />
|
||||
|
||||
<section>
|
||||
<h1>Checkbox</h1>
|
||||
<div>
|
||||
<Checkbox
|
||||
:checked="true"
|
||||
text="Checkbox example"
|
||||
hint="(click to toggle)"
|
||||
/>
|
||||
<Checkbox
|
||||
:checked="false"
|
||||
text="Another checkbox example"
|
||||
hint="(click to toggle)"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<InlineDemo />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
// import { PluginObject } from 'vue';
|
||||
|
||||
import { addIcon, addCollection, disableCache } from 'iconify-icon';
|
||||
import bxShapes from '@iconify-icons/bx/bxs-shapes';
|
||||
|
||||
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';
|
||||
|
||||
// Disable cache
|
||||
disableCache('all');
|
||||
|
||||
// Add few icons
|
||||
addIcon('demo', bxShapes);
|
||||
addIcon('experiment2', {
|
||||
width: 16,
|
||||
height: 16,
|
||||
body: '<mask id="coffee-mask" x="0" y="0" width="16" height="16"><g fill="white"><path d="M5-2c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4M8.5-2c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4M12-2c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4" stroke="white" stroke-width="1" fill="none"><animateMotion path="M0 0v-8" calcMode="linear" dur="3s" repeatCount="indefinite" /></path></g><rect y="4" width="16" height="12" fill="black" /><path d="M2 5H13C14.1046 5 15 5.89543 15 7V8C15 9.10457 14.1046 10 13 10H12V14C12 15.1046 11.1046 16 10 16H4C2.89543 16 2 15.1046 2 14V5Z" fill="white" /><path d="M12 6H13C13.5523 6 14 6.44772 14 7V8C14 8.55228 13.5523 9 13 9H12V6Z" fill="black" /></mask><rect mask="url(#coffee-mask)" width="16" height="16" fill="currentColor" />',
|
||||
});
|
||||
|
||||
// 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,
|
||||
});
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Checkbox,
|
||||
InlineDemo,
|
||||
OfflineUsageDemo,
|
||||
UsageDemo,
|
||||
},
|
||||
})
|
||||
export default class App extends Vue {}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#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 {
|
||||
margin-right: 4px;
|
||||
color: #afafaf;
|
||||
font-size: 24px;
|
||||
line-height: 1em;
|
||||
vertical-align: -0.25em;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
</style>
|
46
iconify-icon-demo/vue2-demo/src/demo-components/Checkbox.vue
Normal file
46
iconify-icon-demo/vue2-demo/src/demo-components/Checkbox.vue
Normal file
@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div class="checkbox-container">
|
||||
<a href="# " :class="className" @click="check">
|
||||
<iconify-icon :icon="icon" />{{ text }}
|
||||
</a>
|
||||
<small>{{ hint }}</small>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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) {
|
||||
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>
|
13
iconify-icon-demo/vue2-demo/src/demo-components/Inline.vue
Normal file
13
iconify-icon-demo/vue2-demo/src/demo-components/Inline.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<section class="inline-demo">
|
||||
<h1>Inline demo</h1>
|
||||
<div>
|
||||
Block icon (behaving like image):
|
||||
<iconify-icon icon="experiment2" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icon (behaving line text / icon font):
|
||||
<iconify-icon icon="experiment2" inline />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
13
iconify-icon-demo/vue2-demo/src/demo-components/Usage.vue
Normal file
13
iconify-icon-demo/vue2-demo/src/demo-components/Usage.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<section class="icon-24">
|
||||
<h1>Usage (full module)</h1>
|
||||
<div>
|
||||
Icon referenced by name:
|
||||
<iconify-icon icon="mdi:home" />
|
||||
</div>
|
||||
<div class="alert">
|
||||
<iconify-icon icon="mdi-light:alert" />Important notice with alert
|
||||
icon!
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<section class="icon-24">
|
||||
<h1>Usage (full module, offline mode)</h1>
|
||||
<div>
|
||||
Icon referenced by name:
|
||||
<iconify-icon icon="demo" />
|
||||
</div>
|
||||
<div>
|
||||
Icon referenced by object:
|
||||
<iconify-icon v-bind:icon="demoIcon" />
|
||||
</div>
|
||||
<div>
|
||||
2 icons imported from icon set:
|
||||
<iconify-icon icon="alert1" />
|
||||
<iconify-icon icon="link1" />
|
||||
</div>
|
||||
<div class="alert">
|
||||
<iconify-icon :icon="alertIcon" />Important notice with alert icon!
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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>
|
9
iconify-icon-demo/vue2-demo/src/main.ts
Normal file
9
iconify-icon-demo/vue2-demo/src/main.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
Vue.config.ignoredElements = ['iconify-icon'];
|
||||
|
||||
new Vue({
|
||||
render: (h) => h(App),
|
||||
}).$mount('#app');
|
13
iconify-icon-demo/vue2-demo/src/shims-tsx.d.ts
vendored
Normal file
13
iconify-icon-demo/vue2-demo/src/shims-tsx.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import Vue, { VNode } from "vue";
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
interface Element extends VNode {}
|
||||
// tslint:disable no-empty-interface
|
||||
interface ElementClass extends Vue {}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
4
iconify-icon-demo/vue2-demo/src/shims-vue.d.ts
vendored
Normal file
4
iconify-icon-demo/vue2-demo/src/shims-vue.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
declare module "*.vue" {
|
||||
import Vue from "vue";
|
||||
export default Vue;
|
||||
}
|
41
iconify-icon-demo/vue2-demo/src/test-components/Class.vue
Normal file
41
iconify-icon-demo/vue2-demo/src/test-components/Class.vue
Normal file
@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Class (components/Class.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<Iciconify-iconon icon="experiment" />
|
||||
</div>
|
||||
<div>
|
||||
Red color:
|
||||
<iconify-icon icon="experiment" class="red-color" />
|
||||
<iconify-icon icon="experiment" :class="redClass" />
|
||||
</div>
|
||||
<div>
|
||||
Red color and 20px:
|
||||
<iconify-icon icon="experiment" class="red-color big-icon" />
|
||||
<iconify-icon icon="experiment" :class="[redClass, bigIcon]" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
|
||||
export default Vue.extend({
|
||||
data: () => {
|
||||
return {
|
||||
redClass: 'red-color',
|
||||
bigIcon: 'big-icon',
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.red-color {
|
||||
color: red;
|
||||
}
|
||||
.big-icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
56
iconify-icon-demo/vue2-demo/src/test-components/Inline.vue
Normal file
56
iconify-icon-demo/vue2-demo/src/test-components/Inline.vue
Normal file
@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Inline (components/Inline.vue)</h1>
|
||||
<div>
|
||||
Block icon (behaving like image):
|
||||
<iconify-icon icon="experiment2" />
|
||||
</div>
|
||||
<div>
|
||||
Inline icon (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 }" />
|
||||
<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>
|
53
iconify-icon-demo/vue2-demo/src/test-components/Style.vue
Normal file
53
iconify-icon-demo/vue2-demo/src/test-components/Style.vue
Normal file
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Style (components/Style.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<iconify-icon icon="experiment" />
|
||||
</div>
|
||||
<div>
|
||||
Red color:
|
||||
<iconify-icon icon="experiment" :style="{ color: 'red' }" />
|
||||
<iconify-icon icon="experiment" style="color: red" />
|
||||
<iconify-icon icon="experiment" :style="redIcon" />
|
||||
</div>
|
||||
<div>
|
||||
40px:
|
||||
<iconify-icon icon="experiment" height="40" />
|
||||
<iconify-icon icon="experiment" width="40" />
|
||||
<iconify-icon icon="experiment" :style="{ fontSize: '40px' }" />
|
||||
<iconify-icon icon="experiment" style="font-size: 40px" />
|
||||
<iconify-icon icon="experiment" :style="bigIcon" />
|
||||
</div>
|
||||
<div>
|
||||
Red and 40px:
|
||||
<iconify-icon icon="experiment" height="40" :style="redIcon" />
|
||||
<iconify-icon
|
||||
icon="experiment"
|
||||
:style="{ color: 'red', fontSize: '40px' }"
|
||||
/>
|
||||
<iconify-icon
|
||||
icon="experiment"
|
||||
style="color: red; font-size: 40px"
|
||||
/>
|
||||
<iconify-icon icon="experiment" :style="[bigIcon, redIcon]" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
|
||||
export default Vue.extend({
|
||||
data: () => {
|
||||
return {
|
||||
redIcon: {
|
||||
color: 'red',
|
||||
},
|
||||
bigIcon: {
|
||||
fontSize: '40px',
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<section>
|
||||
<h1>Transformations (components/Transform.vue)</h1>
|
||||
<div>
|
||||
Default icon:
|
||||
<iconify-icon icon="experiment" />
|
||||
</div>
|
||||
<div>
|
||||
Flip horizontally:
|
||||
<iconify-icon icon="experiment" flip="horizontal" />
|
||||
</div>
|
||||
<div>
|
||||
Flip vertically:
|
||||
<iconify-icon icon="experiment" flip="vertical" />
|
||||
</div>
|
||||
<div>
|
||||
Flip horizontally and vertically:
|
||||
<iconify-icon icon="experiment" flip="horizontal,vertical" />
|
||||
</div>
|
||||
<div>
|
||||
90° rotation:
|
||||
<iconify-icon icon="experiment" rotate="1" />
|
||||
<iconify-icon icon="experiment" rotate="90deg" />
|
||||
<iconify-icon icon="experiment" rotate="25%" />
|
||||
</div>
|
||||
<div>
|
||||
180° rotation:
|
||||
<iconify-icon icon="experiment" rotate="2" />
|
||||
<iconify-icon icon="experiment" rotate="180deg" />
|
||||
<iconify-icon icon="experiment" rotate="50%" />
|
||||
</div>
|
||||
<div>
|
||||
270° rotation:
|
||||
<iconify-icon icon="experiment" rotate="3" />
|
||||
<iconify-icon icon="experiment" rotate="270deg" />
|
||||
<iconify-icon icon="experiment" rotate="-25%" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
iconify-icon {
|
||||
font-size: 20px;
|
||||
line-height: 1em;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,122 @@
|
||||
<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"
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Inline icon with bound style as string (purple, 2em, no alignment):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="icon1StyleStr"
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Combined styles (green, 2em, shadow):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="[boxShadowStyleObj, fontSizeStyleObj2]"
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
Dynamic style (red / green, shadow):
|
||||
<iconify-icon
|
||||
icon="admin-users"
|
||||
v-bind:style="[boxShadowStyleObj, dynamicStyleObj]"
|
||||
inline
|
||||
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,
|
||||
]"
|
||||
inline
|
||||
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 { Vue } from 'vue-property-decorator';
|
||||
import { addIcon } from 'iconify-icon';
|
||||
import adminUsers from '@iconify-icons/dashicons/admin-users';
|
||||
|
||||
addIcon('admin-users', adminUsers);
|
||||
|
||||
export default Vue.extend({
|
||||
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,11 @@
|
||||
<template>
|
||||
<iconify-icon icon="customizer" height="20" :style="{ color: 'blue' }" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
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,18 @@
|
||||
<template>
|
||||
<iconify-icon :icon="icons.chart" height="20" :style="{ color: 'red' }" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import adminCustomizer from '@iconify-icons/dashicons/admin-customizer';
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
chart: JSON.stringify(adminCustomizer),
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
39
iconify-icon-demo/vue2-demo/tsconfig.json
Normal file
39
iconify-icon-demo/vue2-demo/tsconfig.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"importHelpers": true,
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"types": [
|
||||
"webpack-env"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user