Skip to content

Commit 3120782

Browse files
authored
Merge pull request #847 from Sysvale/bugfix/fix-top-app-bar
Bugfix/fix top app bar
2 parents 9300746 + db8402f commit 3120782

File tree

4 files changed

+57
-36
lines changed

4 files changed

+57
-36
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysvale/cuida",
3-
"version": "3.91.0",
3+
"version": "3.91.1",
44
"description": "A design system built by Sysvale, using storybook and Vue components",
55
"repository": {
66
"type": "git",

src/components/TopAppBar.vue

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
<template>
22
<div class="top-app-bar">
3-
<icon
4-
v-if="showMenuIcon"
5-
class="top-app-bar__menu"
6-
name="menu-outline"
7-
:width="iconSize"
8-
:height="iconSize"
9-
@click="emit('on-menu-click')"
10-
/>
11-
<router-link
12-
v-else-if="showBackNavigation"
13-
:to="handleRouterBack"
14-
>
3+
<div class="top-app-bar__menu-container">
154
<icon
16-
name="arrow-left-outline"
5+
v-if="showMenuIcon"
6+
class="top-app-bar__menu"
7+
name="menu-outline"
178
:width="iconSize"
189
:height="iconSize"
10+
@click="emit('on-menu-click')"
1911
/>
20-
</router-link>
21-
<img
22-
v-if="logoUrl"
23-
class="top-app-bar__logo-image"
24-
:src="logoUrl"
25-
:alt="title"
26-
>
27-
<h2
28-
v-else
29-
class="top-app-bar__title"
30-
>
31-
{{ title }}
32-
</h2>
12+
<router-link
13+
v-else-if="showBackNavigation"
14+
:to="handleRouterBack"
15+
>
16+
<icon
17+
class="top-app-bar__back-arrow"
18+
name="arrow-left-outline"
19+
:width="iconSize"
20+
:height="iconSize"
21+
/>
22+
</router-link>
23+
<img
24+
v-if="logoUrl"
25+
class="top-app-bar__logo-image"
26+
:src="logoUrl"
27+
:alt="title"
28+
>
29+
<h2
30+
v-else
31+
class="top-app-bar__title"
32+
>
33+
{{ title }}
34+
</h2>
35+
</div>
3336
<div class="top-app-bar__actions">
3437
<!-- @slot Slot utilizado para os botões de action do lado direito-->
3538
<slot name="actions" />
@@ -141,10 +144,16 @@ function handleRouterBack() {
141144
width: 100%;
142145
z-index: $z-index-modal;
143146
144-
&__menu {
147+
&__menu, &__back-arrow {
145148
cursor: pointer;
146149
}
147150
151+
&__menu-container {
152+
display: flex;
153+
align-items: center;
154+
gap: spacer(6);
155+
}
156+
148157
&__title {
149158
@include subheading-2;
150159
}
@@ -155,7 +164,7 @@ function handleRouterBack() {
155164
}
156165
157166
&__logo-image {
158-
height: 100%;
167+
height: 50px;
159168
}
160169
}
161170

src/stories/components/TopAppBar.stories.mdx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@ export const Template = (args) => ({
3333
src="https://images.unsplash.com/photo-1738526787238-96d5352c2ba9?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
3434
style="width: 100%; height: 100%;"
3535
/>
36-
<cds-top-app-bar v-bind="args" />
36+
<cds-top-app-bar
37+
v-bind="args"
38+
@on-menu-click="logMenuClick"
39+
/>
3740
</div>
3841
`,
42+
methods: {
43+
logMenuClick() {
44+
console.info('Menu click emitted');
45+
},
46+
},
3947
});
4048

41-
4249
# TopAppBar
4350

4451
### O TopAppBar é um componente de barra de aplicação responsivo que pode exibir um título, um logotipo, um botão de menu e ações personalizadas.
@@ -51,7 +58,6 @@ export const Template = (args) => ({
5158
- Quando for necessário exibir um logotipo ou título na parte superior da interface.
5259
- Quando houver ações que precisam estar sempre acessíveis na barra superior.
5360

54-
5561
<br />
5662

5763
## Quando não usar:
@@ -68,6 +74,10 @@ export const Template = (args) => ({
6874
name="TopAppBar"
6975
args={{
7076
title: 'Título bacana',
77+
logoUrl: 'https://framerusercontent.com/images/xz7CrU73qctPY2Vm79XMnTAVM.svg',
78+
showMenuIcon: true,
79+
showBackNavigation: false,
80+
defaultRoute: { name: 'rota-default' },
7181
}}
7282
>
7383
{ Template.bind({}) }

src/tests/__snapshots__/TopAppBar.spec.ts.snap

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`TopAppBar > renders correctly 1`] = `
4-
"<div data-v-ea2050ea="" class="top-app-bar"><svg data-v-ea2050ea="" xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" aria-labelledby="menu-outline" role="presentation" class="top-app-bar__menu">
5-
<g fill="currentColor"></g>
6-
</svg>
7-
<h2 data-v-ea2050ea="" class="top-app-bar__title">Título massa</h2>
4+
"<div data-v-ea2050ea="" class="top-app-bar">
5+
<div data-v-ea2050ea="" class="top-app-bar__menu-container"><svg data-v-ea2050ea="" xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" aria-labelledby="menu-outline" role="presentation" class="top-app-bar__menu">
6+
<g fill="currentColor"></g>
7+
</svg>
8+
<h2 data-v-ea2050ea="" class="top-app-bar__title">Título massa</h2>
9+
</div>
810
<div data-v-ea2050ea="" class="top-app-bar__actions">
911
<!-- @slot Slot utilizado para os botões de action do lado direito-->
1012
</div>

0 commit comments

Comments
 (0)