<i class="player-seat"><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<path d="m62 21h-60a1 1 0 0 1 -1-1 12 12 0 0 1 12-12h38a12 12 0 0 1 12 12 1 1 0 0 1 -1 1zm-58.95-2h57.95a10 10 0 0 0 -10-9h-38a10 10 0 0 0 -9.95 9z" />
<path d="m62 26h-60a1 1 0 0 1 -1-1v-5a1 1 0 0 1 1-1h60a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1zm-59-2h58v-3h-58z" />
<path d="m62 56h-60a1 1 0 0 1 -1-1v-5a1 1 0 0 1 1-1h60a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1zm-59-2h58v-3h-58z" />
<path d="m23 42h-10a1 1 0 0 1 -1-1v-6a5 5 0 0 1 5-5h2a5 5 0 0 1 5 5v6a1 1 0 0 1 -1 1zm-9-2h8v-5a3 3 0 0 0 -3-3h-2a3 3 0 0 0 -3 3z" />
<path d="m24 46h-12a2 2 0 0 1 -2-2v-1a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v1a2 2 0 0 1 -2 2zm-11-4a1 1 0 0 0 -1 1v1h12v-1a1 1 0 0 0 -1-1z" />
<path d="m18 51a1 1 0 0 1 -1-1v-5a1 1 0 0 1 2 0v5a1 1 0 0 1 -1 1z" />
<path d="m37 42h-10a1 1 0 0 1 -1-1v-6a5 5 0 0 1 5-5h2a5 5 0 0 1 5 5v6a1 1 0 0 1 -1 1zm-9-2h8v-5a3 3 0 0 0 -3-3h-2a3 3 0 0 0 -3 3z" />
<path d="m38 46h-12a2 2 0 0 1 -2-2v-1a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v1a2 2 0 0 1 -2 2zm-11-4a1 1 0 0 0 -1 1v1h12v-1a1 1 0 0 0 -1-1z" />
<path d="m32 51a1 1 0 0 1 -1-1v-5a1 1 0 0 1 2 0v5a1 1 0 0 1 -1 1z" />
<path d="m51 42h-10a1 1 0 0 1 -1-1v-6a5 5 0 0 1 5-5h2a5 5 0 0 1 5 5v6a1 1 0 0 1 -1 1zm-9-2h8v-5a3 3 0 0 0 -3-3h-2a3 3 0 0 0 -3 3z" />
<path d="m52 46h-12a2 2 0 0 1 -2-2v-1a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v1a2 2 0 0 1 -2 2zm-11-4a1 1 0 0 0 -1 1v1h12v-1a1 1 0 0 0 -1-1z" />
<path d="m46 51a1 1 0 0 1 -1-1v-5a1 1 0 0 1 2 0v5a1 1 0 0 1 -1 1z" />
<path d="m58 51h-52a1 1 0 0 1 -1-1v-25a1 1 0 0 1 1-1h52a1 1 0 0 1 1 1v25a1 1 0 0 1 -1 1zm-51-2h50v-23h-50z" />
</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": "player-seat"
}
<?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