@@ -154,20 +167,10 @@ export default {
{ top: '20%', left: '90%' },
{ top: '80%', left: '20%' }
],
- selectedFontSize: 'text-base',
+ selectedFontSize: 20, // Default font size
+ sliderValue: 2, // Default value in the exponential range
+ fontSizeValues: [8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 320], // Exponential values
icons: icons,
- fontSizes: [
- { name: '12px', value: 'text-xs' },
- { name: '16px', value: 'text-sm' },
- { name: '20px', value: 'text-base' },
- { name: '24px', value: 'text-lg' },
- { name: '28px', value: 'text-xl' },
- { name: '32px', value: 'text-2xl' },
- { name: '40px', value: 'text-3xl' },
- { name: '48px', value: 'text-4xl' },
- { name: '56px', value: 'text-5xl' },
- { name: '64px', value: 'text-6xl' },
- ],
pureColor: 'rgb(133, 133, 133)',
downloadFormat: 'svg',
openBottombar: false
@@ -183,8 +186,11 @@ export default {
toggleTheme,
toggleBottombar() {
this.openBottombar = !this.openBottombar;
+ },
+ updateFontSize() {
+ this.selectedFontSize = this.fontSizeValues[this.sliderValue];
}
- },
+ }
}
@@ -196,4 +202,33 @@ export default {
filter: blur(300px);
position: absolute;
}
+
+.slider-input {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 100%;
+ height: 0px;
+ border-radius: 4px;
+ transition: background 0.3s ease;
+ @apply dark:bg-neutral-300 bg-neutral-300
+}
+
+.slider-input::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 16px;
+ height: 16px;
+ border-radius: 50%;
+ cursor: grab;
+ @apply dark:bg-black bg-neutral-600
+}
+
+.slider-input::-moz-range-thumb {
+ width: 16px;
+ height: 16px;
+ border-radius: 50%;
+ cursor: grab;
+ @apply dark:bg-neutral-800 bg-neutral-600
+}
+
From 3b66ce1cfb3aed2a49e7d0f93200dbf885c1a875 Mon Sep 17 00:00:00 2001
From: Eduardo de Cesaro <44036260+cesaroeduardo@users.noreply.github.com>
Date: Thu, 12 Sep 2024 17:58:46 -0300
Subject: [PATCH 2/3] update slider
---
src/App.vue | 36 ++++++++--------
src/components/IconCard.vue | 85 ++++++++++++-------------------------
2 files changed, 46 insertions(+), 75 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 8d0f01e..02dd336 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -36,15 +36,15 @@
+ v-for="icon in icons"
+ :key="icon.name"
+ :name="icon.name"
+ :keywords="icon.keywords"
+ :icon="icon.icon"
+ :color="IconsColor"
+ :size="`${selectedFontSize}px`"
+ :download-format="downloadFormat"
+ >
@@ -79,15 +79,15 @@
@@ -123,15 +123,15 @@
@@ -172,7 +172,7 @@ export default {
fontSizeValues: [8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 320], // Exponential values
icons: icons,
pureColor: 'rgb(133, 133, 133)',
- downloadFormat: 'svg',
+ downloadFormat: 'png',
openBottombar: false
}
},
diff --git a/src/components/IconCard.vue b/src/components/IconCard.vue
index 535f978..36a173d 100644
--- a/src/components/IconCard.vue
+++ b/src/components/IconCard.vue
@@ -46,7 +46,7 @@ export default {
},
size: {
type: String,
- required: true,
+ required: true, // Esse "size" pode ser uma classe do Tailwind CSS
},
downloadFormat: {
type: String,
@@ -60,6 +60,29 @@ export default {
};
},
methods: {
+ // Extração do valor em pixels de uma string no formato `text-[XXpx]`
+ getPixelSize(sizeClass) {
+ if (typeof sizeClass === 'string' && sizeClass.endsWith('px')) {
+ return parseInt(sizeClass.replace('px', ''), 10);
+ }
+ return sizeClass; // Se já for um número ou outra unidade que não é px, retorna diretamente
+ },
+ // Mapeia as classes do Tailwind para tamanhos reais em pixels
+ getDimension(sizeClass) {
+ const sizeMap = {
+ 'text-xs': 12,
+ 'text-sm': 16,
+ 'text-base': 20,
+ 'text-lg': 24,
+ 'text-xl': 28,
+ 'text-2xl': 32,
+ 'text-3xl': 40,
+ 'text-4xl': 48,
+ 'text-5xl': 56,
+ 'text-6xl': 64,
+ };
+ return sizeMap[sizeClass] || 100; // Valor padrão caso a classe não seja mapeada
+ },
async downloadIcon() {
if (this.downloadFormat === 'svg') {
this.downloadSVG();
@@ -82,19 +105,7 @@ export default {
svg = svg.replace(/fill="[^"]*"/g, `fill="${this.color}"`);
}
- const sizeMap = {
- 'text-xs': 12,
- 'text-sm': 16,
- 'text-base': 20,
- 'text-lg': 24,
- 'text-xl': 28,
- 'text-2xl': 32,
- 'text-3xl': 40,
- 'text-4xl': 48,
- 'text-5xl': 56,
- 'text-6xl': 64,
- };
- const dimension = sizeMap[this.size] || 100;
+ const dimension = this.getPixelSize(this.size); // Usa o valor correto em pixels
if (!svg.includes('width=')) {
svg = svg.replace(/