You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cookbook/editable-svg-icons.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,26 @@
1
-
# Editable SVG Icon Systems
1
+
# Sistemas de Ícones SVG Editáveis
2
2
3
-
## Base Example
3
+
## Exemplo Base
4
4
5
-
There are many ways to create an SVG Icon System, but one method that takes advantage of Vue's capabilities is to create editable inline icons as components. Some of the advantages of this way of working is:
5
+
Existem muitas formas de criar um sistema de ícone SVG, mas o método que tira vantagem das capacidades do Vue é criar ícones *inline* editáveis como componente. Algumas das vantagens desta forma de trabalhar são:
6
6
7
-
-They are easy to edit on the fly
8
-
-They are animatable
9
-
-You can use standard props and defaults to keep them to a typical size or alter them if you need to
10
-
-They are inline, so no HTTP requests are necessary
11
-
-They can be made accessible dynamically
7
+
-São fáceis de se editar em tempo real
8
+
-São animáveis
9
+
-Pode se usar props, definindo padrões ou alterando-as caso necessário
10
+
-São incorporados, então não exigem requisições HTTP adicionais
11
+
-Eles podem ser acessados dinamicamente
12
12
13
-
First, we'll create a folder for all of the icons, and name them in a standardized fashion for easy retrieval:
13
+
Primeiro, vamos criar uma pasta para todos os ícones, e nomeá-los de forma padronizada para fácil recuperação:
14
14
15
15
-`components/icons/IconBox.vue`
16
16
-`components/icons/IconCalendar.vue`
17
17
-`components/icons/IconEnvelope.vue`
18
18
19
-
Here's an example repo to get you going, where you can see the entire setup: [https://github.com/sdras/vue-sample-svg-icons/](https://github.com/sdras/vue-sample-svg-icons/)
19
+
Eis um exemplo de repositório, onde pode ver toda a configuração: [https://github.com/sdras/vue-sample-svg-icons/](https://github.com/sdras/vue-sample-svg-icons/)
We'll create a base icon (`IconBase.vue`) component that uses a slot.
23
+
Vamos criar um componente de ícone base (`IconBase.vue`) que usa um `slot`.
24
24
25
25
```html
26
26
<template>
@@ -40,9 +40,9 @@ We'll create a base icon (`IconBase.vue`) component that uses a slot.
40
40
</template>
41
41
```
42
42
43
-
You can use this base icon as is- the only thing you might need to update is the `viewBox`depending on the `viewBox`of your icons. In the base, we're making the `width`, `height`, `iconColor`, and name of the icon props so that it can be dynamically updated with props. The name will be used for both the `<title>`content and its `id`for accessibility.
43
+
Você pode usar essa base de ícones do jeito que está – a única coisa que você pode precisar atualizar é a e `viewBox`dependendo da `viewBox`dos ícones que for utilizar. Na base, vamos usar propriedades para `width`, `height`, `iconColor`, e `iconColor`, para que possam ser atualizados dinamicamente. O nome será usado tanto para o conteúdo do `<title>`como do `id`para acessilibidade.
44
44
45
-
Our script will look like this, we'll have some defaults so that our icon will be rendered consistently unless we state otherwise:
45
+
Nosso script ficará assim, teremos alguns valores padrão para que nosso ícone seja renderizado de forma consistente, a menos que declaremos o contrário:
46
46
47
47
```js
48
48
exportdefault {
@@ -67,30 +67,30 @@ export default {
67
67
}
68
68
```
69
69
70
-
The `currentColor`property that's the default on the fill will make the icon inherit the color of whatever text surrounds it. We could also pass in a different color as a prop if we wish.
70
+
A propriedade `currentColor`, usada como padrão para o preenchimento, irá permitir ao ícone herdar a cor do texto que o rodeia. Também poderíamos passar uma cor diferente como `prop` se quisermos.
71
71
72
-
We can use it like so, with the only contents of`IconWrite.vue`containing the paths inside the icon:
72
+
Podemos usá-lo assim, com o único conteúdo de`IconWrite.vue`contendo os `path` dentro do ícone:
Keeping icons in components comes in very handy when you'd like to animate them, especially on an interaction. Inline SVGs have the highest support for interaction of any method. Here's a very basic example of an icon that's animated on click:
0 commit comments