Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#43842] added action bar stories

Eric Schubert606ed1003b40
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 208ce2a337a..05652d9a57b 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -49,6 +49,7 @@ module.exports = {
"error",
{ "type": "element", "prefix": ["op", "spot"], "style": "kebab-case" }
],
+ "@angular-eslint/component-class-suffix": ["error", { "suffixes": ["Component", "Example"] }],
// Warn when new components are being created without OnPush
"change-detection-strategy/on-push": "error",
diff --git a/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.modal.html b/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.modal.html
index 7cb583db08b..ac51ffb8631 100644
--- a/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.modal.html
+++ b/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.modal.html
@@ -27,7 +27,7 @@
<div class="spot-action-bar--right">
<button
type="button"
- class="button button_no-margin spot-action-bar--action"
+ class="button spot-action-bar--action"
data-qa-selector="confirmation-modal--cancel"
(click)="closeMe($event)"
>
@@ -36,7 +36,7 @@
</button>
<button
type="button"
- class="button button_no-margin spot-action-bar--action"
+ class="button spot-action-bar--action"
data-qa-selector="confirmation-modal--confirmed"
[ngClass]="dangerHighlighting ? '-danger': '-highlight'"
(click)="confirmAndClose($event)"
diff --git a/frontend/src/app/spot/styles/sass/components/action-bar.sass b/frontend/src/app/spot/styles/sass/components/action-bar.sass
index 68913adf01a..8d4f50988a6 100644
--- a/frontend/src/app/spot/styles/sass/components/action-bar.sass
+++ b/frontend/src/app/spot/styles/sass/components/action-bar.sass
@@ -1,9 +1,12 @@
.spot-action-bar
display: grid
grid-template-columns: 1fr
- padding: $spot-spacing-0_75 $spot-spacing-1
+ padding: 0 $spot-spacing-1 $spot-spacing-0_75 0
background-color: $spot-color-basic-gray-6
+ &__transparent
+ background-color: unset
+
&--left,
&--right
display: flex
@@ -11,31 +14,16 @@
flex-wrap: wrap
align-items: center
justify-content: flex-end
+ margin-top: -$spot-spacing-0_25
> .spot-action-bar--action
- margin-left: $spot-spacing-1
-
- &--left
- > .spot-action-bar--action
- margin-bottom: $spot-spacing-1
+ margin: $spot-spacing-1 0 0 $spot-spacing-1
@media #{$spot-mq-action-bar-change}
grid-template-columns: 1fr auto
- &--left,
- &--right
- > .spot-action-bar--action
- margin-left: 0
- margin-bottom: 0
-
&--left
justify-content: flex-start
- > .spot-action-bar--action:not(:last-child)
- margin-right: $spot-spacing-1
-
&--right
justify-content: flex-end
-
- > .spot-action-bar--action:not(:first-child)
- margin-left: $spot-spacing-1
diff --git a/frontend/src/stories/ActionBar.example.html b/frontend/src/stories/ActionBar.example.html
index 412df4e95bb..b28eaec3b43 100644
--- a/frontend/src/stories/ActionBar.example.html
+++ b/frontend/src/stories/ActionBar.example.html
@@ -1,14 +1,17 @@
<div class="spot-action-bar">
<div class="spot-action-bar--left">
<a
- class="spot-link"
+ class="spot-link spot-action-bar--action"
href="#"
- >Some link</a>
+ >
+ <span class="spot-icon spot-icon_cancel"></span>
+ <span>Side action</span>
+ </a>
</div>
<div class="spot-action-bar--right">
<button
type="button"
- class="spot-action-bar--action button"
- >Some Button</button>
+ class="spot-action-bar--action button -highlight"
+ >Okay</button>
</div>
</div>
diff --git a/frontend/src/stories/ActionBar.example.ts b/frontend/src/stories/ActionBar.example.ts
index fe025b2508a..dfc8cf5679e 100644
--- a/frontend/src/stories/ActionBar.example.ts
+++ b/frontend/src/stories/ActionBar.example.ts
@@ -1,6 +1,7 @@
-import { Component } from '@angular/core';
+import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
templateUrl: './ActionBar.example.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class SbActionBarExample { }
+export class SbActionBarExample {}
diff --git a/frontend/src/stories/ActionBar.stories.mdx b/frontend/src/stories/ActionBar.stories.mdx
index 07a193fdf39..fc2a0df6500 100644
--- a/frontend/src/stories/ActionBar.stories.mdx
+++ b/frontend/src/stories/ActionBar.stories.mdx
@@ -4,6 +4,9 @@ import { Canvas, Meta, Story } from '@storybook/addon-docs';
import { OpSpotModule } from '../app/spot/spot.module';
import { SbActionBarExample } from './ActionBar.example';
import { SbActionBarLeftButtonsExample } from './ActionBarLeftButtons.example';
+import { SbActionBarTransparentExample } from './ActionBarTransparent.example';
+import { SbActionBarNoSideOptionExample } from './ActionBarNoSideOption.example';
+import { SbActionBarMoreButtonsExample } from './ActionBarMoreButtons.example';
<Meta
title="Patterns/Action Bar"
@@ -26,7 +29,7 @@ import { SbActionBarLeftButtonsExample } from './ActionBarLeftButtons.example';
> Example of action bar in a modal
-The action bar is generally used at the bottom of modals to present the user with a set of actions. These actions are often relative to choices or selections made in the containing modal.
+The action bar is generally used at the bottom of modals to present the user with a set of actions. These actions are often relative to choices or selections made in the containing modal.
The most common choices are "Save/apply" and "Cancel".  At least one button (Cancel) is the absolute minimum.
@@ -69,7 +72,11 @@ The button set can be moved to the left, placing the side action on the right. T
**Transparent background**
-> Example
+<Canvas>
+ <Story name="Transparent">
+ {{ component: SbActionBarTransparentExample }}
+ </Story>
+</Canvas>
The transparent background is useful for when having the action bar in grey (default) does not work visually. The transparent version will simply take the background colour of the element in which it is contained, usually white.
@@ -77,15 +84,23 @@ The transparent background is useful for when having the action bar in grey (def
**Side options**
-> Example without side option
+<Canvas>
+ <Story name="No side option">
+ {{ component: SbActionBarNoSideOptionExample }}
+ </Story>
+</Canvas>
The side option is, as the name suggests, optional.
**More buttons**
-> Example with three buttons: Watch, Mark as read, More
+<Canvas>
+ <Story name="More buttons">
+ {{ component: SbActionBarMoreButtonsExample }}
+ </Story>
+</Canvas>
-The action bar can also be composed of up to three action buttons. Should there be more than three actions to be made available to the user, the third button will be a “More” button opens a drop-down with additional options.
+The action bar can also be composed of up to three action buttons. Should there be more than three actions to be made available to the user, the third button will be a “More” button opens a drop-down with additional options.
## Behaviour
@@ -95,12 +110,12 @@ When the action bar is use as a toolbar with more three buttons (or with a “Mo
## Line breaks and wrapping
-When the text is too long, the button set will remain in one line, and the side option (if present) will move to a new line.
+When the text is too long, the button set will remain in one line, and the side option (if present) will move to a new line.
If the text in the side option is too long, that will itself also wrap in mutliple lines.
## Margins, Padding and Styling
The action bar normally no external margin and usually spans the full length of the parent element.
-
+
It has 16px left/right padding and 12 px top/bottom padding, with 16 px spacing between the two buttons in the button set.
diff --git a/frontend/src/stories/ActionBarLeftButtons.example.html b/frontend/src/stories/ActionBarLeftButtons.example.html
index 72da01da1a5..1ff9cdc48c3 100644
--- a/frontend/src/stories/ActionBarLeftButtons.example.html
+++ b/frontend/src/stories/ActionBarLeftButtons.example.html
@@ -10,7 +10,7 @@
>Save</button>
</div>
<div class="spot-action-bar--right">
- <label>
+ <label class="spot-action-bar--action">
Remember this choice
<spot-checkbox></spot-checkbox>
</label>
diff --git a/frontend/src/stories/ActionBarLeftButtons.example.ts b/frontend/src/stories/ActionBarLeftButtons.example.ts
index b6c731f0b42..455a498f510 100644
--- a/frontend/src/stories/ActionBarLeftButtons.example.ts
+++ b/frontend/src/stories/ActionBarLeftButtons.example.ts
@@ -1,6 +1,7 @@
-import { Component } from '@angular/core';
+import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
templateUrl: './ActionBarLeftButtons.example.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SbActionBarLeftButtonsExample { }
diff --git a/frontend/src/stories/ActionBarMoreButtons.example.html b/frontend/src/stories/ActionBarMoreButtons.example.html
new file mode 100644
index 00000000000..ade68208cfb
--- /dev/null
+++ b/frontend/src/stories/ActionBarMoreButtons.example.html
@@ -0,0 +1,25 @@
+<div class="spot-action-bar">
+ <div class="spot-action-bar--left">
+ <button
+ type="button"
+ class="spot-action-bar--action button"
+ >
+ <span class="spot-icon spot-icon_watched"></span>
+ <span [textContent]="'Watch'"></span>
+ </button>
+ <button
+ type="button"
+ class="spot-action-bar--action button"
+ >
+ <span class="spot-icon spot-icon_mark-read"></span>
+ <span [textContent]="'Mark as read'"></span>
+ </button>
+ <button
+ type="button"
+ class="spot-action-bar--action button"
+ >
+ <span [textContent]="'More'"></span>
+ <span class="spot-icon spot-icon_arrow-down1"></span>
+ </button>
+ </div>
+</div>
diff --git a/frontend/src/stories/ActionBarMoreButtons.example.ts b/frontend/src/stories/ActionBarMoreButtons.example.ts
new file mode 100644
index 00000000000..0331621093b
--- /dev/null
+++ b/frontend/src/stories/ActionBarMoreButtons.example.ts
@@ -0,0 +1,7 @@
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ templateUrl: './ActionBarMoreButtons.example.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class SbActionBarMoreButtonsExample { }
diff --git a/frontend/src/stories/ActionBarNoSIdeOption.example.html b/frontend/src/stories/ActionBarNoSIdeOption.example.html
new file mode 100644
index 00000000000..4c5629d6ea6
--- /dev/null
+++ b/frontend/src/stories/ActionBarNoSIdeOption.example.html
@@ -0,0 +1,16 @@
+<div class="spot-action-bar">
+ <div class="spot-action-bar--right">
+ <button
+ type="button"
+ class="spot-action-bar--action button"
+ >
+ <span [textContent]="'Cancel'"></span>
+ </button>
+ <button
+ type="button"
+ class="spot-action-bar--action button -highlight"
+ >
+ <span [textContent]="'Next'"></span>
+ </button>
+ </div>
+</div>
diff --git a/frontend/src/stories/ActionBarNoSideOption.example.ts b/frontend/src/stories/ActionBarNoSideOption.example.ts
new file mode 100644
index 00000000000..15c1baa7eb4
--- /dev/null
+++ b/frontend/src/stories/ActionBarNoSideOption.example.ts
@@ -0,0 +1,7 @@
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ templateUrl: './ActionBarNoSIdeOption.example.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class SbActionBarNoSideOptionExample { }
diff --git a/frontend/src/stories/ActionBarTransparent.example.html b/frontend/src/stories/ActionBarTransparent.example.html
new file mode 100644
index 00000000000..a820aaac152
--- /dev/null
+++ b/frontend/src/stories/ActionBarTransparent.example.html
@@ -0,0 +1,25 @@
+<div class="spot-action-bar spot-action-bar__transparent">
+ <div class="spot-action-bar--left">
+ <a
+ class="spot-link spot-action-bar--action"
+ href="#"
+ >
+ <span [textContent]="'Side action'"></span>
+ </a>
+ </div>
+ <div class="spot-action-bar--right">
+ <button
+ type="button"
+ class="spot-action-bar--action button"
+ >
+ <span [textContent]="'Cancel'"></span>
+ </button>
+ <button
+ type="button"
+ class="spot-action-bar--action button -danger"
+ >
+ <span class="spot-icon spot-icon_delete"></span>
+ <span [textContent]="'Delete'"></span>
+ </button>
+ </div>
+</div>
diff --git a/frontend/src/stories/ActionBarTransparent.example.ts b/frontend/src/stories/ActionBarTransparent.example.ts
new file mode 100644
index 00000000000..c94a1e4ae4c
--- /dev/null
+++ b/frontend/src/stories/ActionBarTransparent.example.ts
@@ -0,0 +1,7 @@
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ templateUrl: './ActionBarTransparent.example.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class SbActionBarTransparentExample { }