2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-13 14:13:06 +00:00
iconify/components/svg-framework/demo/loading-icons.without-api.html

151 lines
6.2 KiB
HTML
Raw Normal View History

2020-07-01 20:29:43 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Iconify Demo: Loading Icons (without API)</title>
<style>
html,
body {
margin: 0;
padding: 0;
background: #fff;
color: #000;
}
body {
padding: 8px;
font-size: 16px;
line-height: 24px;
}
p {
margin: 0;
padding: 8px;
color: rgba(0, 0, 0, 0.8);
}
p:nth-child(2n) {
background-color: #f8f8f8;
}
svg {
color: #292;
}
</style>
<script>
// Preload icons before importing Iconify
IconifyPreload = [
{
prefix: 'z123-preload',
icons: {
check2: {
2022-01-12 09:27:28 +00:00
body: '<g fill="currentColor"><path fill-rule="evenodd" d="M12.354 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"></path><path d="M6.25 8.043l-.896-.897a.5.5 0 1 0-.708.708l.897.896l.707-.707zm1 2.414l.896.897a.5.5 0 0 0 .708 0l7-7a.5.5 0 0 0-.708-.708L8.5 10.293l-.543-.543l-.707.707z"/></g>',
2020-07-01 20:29:43 +00:00
},
},
width: 16,
height: 16,
},
{
provider: 'test-provider',
prefix: 'z234-preload',
icons: {
check2: {
2022-01-12 09:27:28 +00:00
body: '<g fill="currentColor"><path fill-rule="evenodd" d="M12.354 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"></path><path d="M6.25 8.043l-.896-.897a.5.5 0 1 0-.708.708l.897.896l.707-.707zm1 2.414l.896.897a.5.5 0 0 0 .708 0l7-7a.5.5 0 0 0-.708-.708L8.5 10.293l-.543-.543l-.707.707z"/></g>',
2020-07-01 20:29:43 +00:00
},
},
width: 16,
height: 16,
},
];
</script>
<script src="../dist/iconify.without-api.min.js"></script>
<script>
// Add icons without provider
Iconify.addCollection({
prefix: 'z123-add-collection',
icons: {
check2: {
2022-01-12 09:27:28 +00:00
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>',
2020-07-01 20:29:43 +00:00
},
},
width: 16,
height: 16,
});
Iconify.addIcon('z123-add-icon:check2', {
2022-01-12 09:27:28 +00:00
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>',
2020-07-01 20:29:43 +00:00
width: 16,
height: 16,
});
// Add icons with provider
Iconify.addCollection(
{
prefix: 'z234-add-collection',
icons: {
check2: {
2022-01-12 09:27:28 +00:00
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" />',
2020-07-01 20:29:43 +00:00
},
},
width: 16,
height: 16,
},
'test-provider'
);
Iconify.addIcon('@test-provider:z234-add-icon:check2', {
2022-01-12 09:27:28 +00:00
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" />',
2020-07-01 20:29:43 +00:00
width: 16,
height: 16,
});
</script>
</head>
<body>
<p>
This page tests various ways to dynamically load icons without API
(except for first example that uses API).<br />
On success, after each line of text there should be a green icon.
</p>
<p>
Icon loaded from API (should not load):
<span class="iconify-inline" data-icon="bi:check2"></span>
</p>
<p>
Icon loaded with addCollection():
<span
class="iconify-inline"
data-icon="z123-add-collection:check2"
></span>
</p>
<p>
Icon loaded with addIcon():
<span
class="iconify-inline"
data-icon="z123-add-icon:check2"
></span>
</p>
<p>
Icon loaded with IconifyPreload:
<span class="iconify-inline" data-icon="z123-preload:check2"></span>
</p>
<p>
Icon loaded with addCollection() and custom provider:
<span
class="iconify-inline"
data-icon="@test-provider:z234-add-collection:check2"
></span>
</p>
<p>
Icon loaded with addIcon() and custom provider:
<span
class="iconify-inline"
data-icon="@test-provider:z234-add-icon:check2"
></span>
</p>
<p>
Icon loaded with IconifyPreload and custom provider:
<span
class="iconify-inline"
data-icon="@test-provider:z234-preload:check2"
></span>
</p>
</body>
</html>