<i class="dummy"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>dummy</title>
<g id="dummy">
<path d="M32,63a1,1,0,0,1-1-1V58a1,1,0,0,1,2,0v4A1,1,0,0,1,32,63Z" />
<path d="M41,63H23a1,1,0,0,1,0-2H41a1,1,0,0,1,0,2Z" />
<path d="M32,15a5,5,0,1,1,5-5A5,5,0,0,1,32,15Zm0-8a3,3,0,1,0,3,3A3,3,0,0,0,32,7Z" />
<path d="M36.19,59H27.81a5,5,0,0,1-5-4.76L22,37.55l-5.58-3.72A1,1,0,0,1,16,33V18a8,8,0,0,1,7-7.94V10a9,9,0,0,1,18,0v.06A8,8,0,0,1,48,18V33a1,1,0,0,1-.45.83L42,37.55l-.79,16.69A5,5,0,0,1,36.19,59ZM18,32.46l5.55,3.71A1,1,0,0,1,24,37l.82,17.19a3,3,0,0,0,3,2.86h8.38a3,3,0,0,0,3-2.86L40,37a1,1,0,0,1,.45-.78L46,32.46V18a6,6,0,0,0-6-6,1,1,0,0,1-1-1V10a7,7,0,0,0-14,0v1a1,1,0,0,1-1,1,6,6,0,0,0-6,6ZM47,33h0Z" />
<path d="M28,32H25a1,1,0,0,1-.71-.29l-2-2A1,1,0,0,1,22,29V21a1,1,0,0,1,.29-.71l2-2A1,1,0,0,1,25,18h3a1,1,0,0,1,.71.29l2,2A1,1,0,0,1,31,21v8a1,1,0,0,1-.29.71l-2,2A1,1,0,0,1,28,32Zm-2.59-2h2.18L29,28.59V21.41L27.59,20H25.41L24,21.41v7.18Z" />
<path d="M39,32H36a1,1,0,0,1-.71-.29l-2-2A1,1,0,0,1,33,29V21a1,1,0,0,1,.29-.71l2-2A1,1,0,0,1,36,18h3a1,1,0,0,1,.71.29l2,2A1,1,0,0,1,42,21v8a1,1,0,0,1-.29.71l-2,2A1,1,0,0,1,39,32Zm-2.59-2h2.18L40,28.59V21.41L38.59,20H36.41L35,21.41v7.18Z" />
<path d="M34,37H30a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Z" />
</g>
</svg></i>
{% set className = className ? className ~ ' ' : '' %}
{% set attributes = className ~ icon | trim %}
{% set insert = true %}
{% if iconType is empty or iconType == 'custom' %}
<i class="{{ attributes }}">{% if insert is defined and insert == true %}{{ source('@customIcons/' ~ icon ~ '.svg') }}{% endif %}</i>
{% elseif iconType is not empty or iconType == 'iconoir' %}
<i class="{{ attributes }}">{% if insert is defined and insert == true %}{{ source('@icons/' ~ icon ~ '.svg') }}{% endif %}</i>
{% endif %}
{
"icon": "dummy"
}
<?php
namespace Theme\Views\Atoms\icon;
use ACFToolkit\Traits\SetWrapperWidth;
use ACFToolkit\Types\CustomAtom;
class Icon extends CustomAtom
{
use SetWrapperWidth;
public string $name = 'icon';
public string $label = 'Icon';
public int $needsJs = 0;
public int $needsVue = 1;
public int $needsVueInitialisation = 0;
public function __construct($name = '', $title = '', $children = [])
{
parent::__construct($name, $title);
$this->addChildren(array_merge($children, [
]));
}
public function getChoices()
{
$customIcons = get_template_directory().'/resources/Views/Assets/dist/custom-icons/*.svg';
$result = [];
$files = glob($customIcons);
foreach($files as $file) {
$filename = basename($file, '.svg');
$result[$filename] = $filename;
}
return $result;
}
}
<?php
namespace Theme\Views\Atoms\icon;
use ACFToolkit\ViewModels\BaseViewModel;
class IconViewModel extends BaseViewModel
{
}
i {
display: inline-block;
width: 26px;
svg {
width: 100%;
vertical-align: top;
}
&.sm {
width: 20px;
}
&.md {
width: 40px;
}
&.lg {
width: 50px;
}
&.xl {
width: 60px;
}
&.star--filled {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo--white {
svg {
g {
fill: #fff;
}
}
}
&.logo_subline {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo_subline--white {
svg {
g {
fill: #fff;
}
}
}
&.logo_subline-subline--accent {
svg {
g {
fill: theme('colors.primary');
&#subline {
fill: theme('colors.accent');
}
}
}
}
&.logo_subline--white-subline--accent {
svg {
g {
fill: #fff;
&#subline {
fill: theme('colors.accent');
}
}
}
}
&.search {
width: 24px;
height: 24px;
}
}
<template>
<i
:class="getTypeClass + '-' + icon + ' ' + className"
v-html="iconSource"
:title="title"
v-if="iconSource"
></i>
</template>
<script>
import IconService from '../../Assets/src/js/services/IconService';
export default {
props: {
className: {
type: String,
default: ''
},
icon: {
type: String,
},
title: {
type: String
},
type: {
type: String,
default: 'custom'
}
},
data: () => {
return {
iconSource: null
}
},
computed: {
getTypeClass(){
return this.type === 'custom' ? 'custom' : 'iconoir'
}
},
async created(){
const {data} = this.type === 'custom' ?
await IconService.getCustom(this.icon) :
await IconService.getIconoir(this.icon)
this.iconSource = data
}
}
</script>
<style>
*[class^="iconoir-"], *[class*=" iconoir-"] {
display: inline-block;
}
</style>
{% include '@atoms/icon/icon.twig' with {
icon: 'icon'
} only %}Fields