refactor: change svg for img for icons

This commit is contained in:
2025-09-23 00:31:28 -03:00
parent 5e9afe0ea8
commit d1a4f9dece
4 changed files with 17 additions and 17 deletions

View File

@@ -4,10 +4,11 @@
width: 100%; width: 100%;
display: flex; display: flex;
mw-svg { mw-img {
align-items: center; align-items: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
width: 100%;
} }
} }

View File

@@ -1,3 +1,3 @@
<div class="circle" [style.backgroundColor]="backgroundColor()"> <div class="circle" [style.backgroundColor]="backgroundColor()">
<mw-svg width="75%" height="75%" [color]="color()" [symbol]="symbol()"></mw-svg> <mw-img [src]="iconPath()"></mw-img>
</div> </div>

View File

@@ -1,10 +1,10 @@
import { Component, input } from '@angular/core'; import { Component, input } from '@angular/core';
import { SvgComponent } from '../../atoms/svg/svg.component'; import { ImgComponent } from '../../atoms/img/img.component';
@Component({ @Component({
selector: 'mw-circled-icon', selector: 'mw-circled-icon',
standalone: true, standalone: true,
imports: [SvgComponent], imports: [ImgComponent],
templateUrl: './circled-icon.component.html', templateUrl: './circled-icon.component.html',
styleUrl: './circled-icon.component.css' styleUrl: './circled-icon.component.css'
}) })
@@ -13,12 +13,8 @@ export class CircledIconComponent {
* @description Circle background color * @description Circle background color
*/ */
backgroundColor = input("#fff"); backgroundColor = input("#fff");
/**
* @description Icon color
*/
color = input("#000000");
/** /**
* @description Icon name * @description Icon name
*/ */
symbol = input(""); iconPath = input("");
} }

View File

@@ -1,7 +1,7 @@
import type { Meta } from '@storybook/angular'; import type { Meta } from '@storybook/angular';
import { CircledIconComponent } from '../../lib/molecules/circled-icon/circled-icon.component'; import { CircledIconComponent } from '../../lib/molecules/circled-icon/circled-icon.component';
import { color, symbol } from '../control-constants/svg';
import { backgroundColor } from '../control-constants/circled-icon'; import { backgroundColor } from '../control-constants/circled-icon';
import { pngIconsList } from '../png-icons-list';
/** /**
* *
* **Sizing**: the circled icon takes all space available in it's parent component * **Sizing**: the circled icon takes all space available in it's parent component
@@ -14,26 +14,29 @@ const meta: Meta<CircledIconComponent> = {
tags: ['autodocs'], tags: ['autodocs'],
args: { args: {
backgroundColor: '#c0c0c0', backgroundColor: '#c0c0c0',
color: '#000000', iconPath: '/assets/icons/caticon0.png',
symbol: 'stock-line',
}, },
argTypes: { argTypes: {
backgroundColor, backgroundColor,
color, iconPath: {
symbol control: 'select',
options: pngIconsList,
description: 'The path to the icon png',
table: {defaultValue: {detail: 'Defaults to none (empty string)', summary: '(empty string)'}}
}
}, },
}; };
export default meta; export default meta;
const Template = (args: {backgroundColor: string, color: string, symbol: string}) => ({ const Template = (args: {backgroundColor: string, color: string, iconPath: string}) => ({
props: args, props: args,
template: ` template: `
<div style="width: 36px; height: 36px; margin: auto;"> <div style="width: 48px; height: 48px; margin: auto;">
<mw-circled-icon <mw-circled-icon
backgroundColor="${args.backgroundColor}" backgroundColor="${args.backgroundColor}"
color="${args.color}" color="${args.color}"
symbol="${args.symbol}" iconPath="${args.iconPath}"
></mw-circled-icon> ></mw-circled-icon>
</div> </div>
` `