Skip to content
Snippets Groups Projects
Commit b4e7cb92 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

Merge branch 'sb/red-tag' into 'dev'

chore(ui): red tags

See merge request !647
parents 0e4b14e5 6a0e2752
No related branches found
No related tags found
2 merge requests!783V3.0.0,!647chore(ui): red tags
...@@ -12,8 +12,12 @@ ...@@ -12,8 +12,12 @@
<app-svg-icon [type]="'ico'" [icon]="getStructureTypeIcon()" [iconClass]="'icon-52'" /> <app-svg-icon [type]="'ico'" [icon]="getStructureTypeIcon()" [iconClass]="'icon-52'" />
<div class="structureInfos"> <div class="structureInfos">
<p class="structureName">{{ structure.structureName }}</p> <p class="structureName">{{ structure.structureName }}</p>
<!-- TODO update this tag to RED --> <app-v3-tag-item
<app-v3-tag-item [clickable]="false" [label]="structure.structureType?.category" [size]="'small'" /> [clickable]="false"
[label]="structure.structureType?.value"
[size]="'small'"
[color]="'red'"
/>
<div *ngIf="!isPublic && !isValid() && !isPending" class="missingData"> <div *ngIf="!isPublic && !isValid() && !isPending" class="missingData">
<app-missing-information [plural]="true" /> <app-missing-information [plural]="true" />
</div> </div>
......
...@@ -307,11 +307,15 @@ ...@@ -307,11 +307,15 @@
/> />
</div> </div>
<div class="content"> <div class="content">
<ng-container *ngIf="isFieldValid('age', 'categories') && structure.categoriesDisplay.age"> <div *ngIf="isFieldValid('age', 'categories') && structure.categoriesDisplay.age" class="list">
<div *ngFor="let public of structure.categoriesDisplay.age" class="list"> <app-v3-tag-item
<p>{{ public }}</p> *ngFor="let public of structure.categoriesDisplay.age"
</div> [label]="public"
</ng-container> [color]="'red'"
[clickable]="false"
[size]="'small'"
/>
</div>
<ng-container *ngIf="!isFieldValid('age', 'categories') && structure.categoriesDisplay.age"> <ng-container *ngIf="!isFieldValid('age', 'categories') && structure.categoriesDisplay.age">
<app-no-information *ngIf="!structure.otherDescription" /> <app-no-information *ngIf="!structure.otherDescription" />
...@@ -338,41 +342,56 @@ ...@@ -338,41 +342,56 @@
/> />
</div> </div>
<div class="content"> <div class="content">
<ng-container <div
*ngIf=" *ngIf="
isFieldValid('languageAndIlliteracy', 'categories') && isFieldValid('languageAndIlliteracy', 'categories') &&
structure.categoriesDisplay && structure.categoriesDisplay &&
structure.categoriesDisplay.languageAndIlliteracy structure.categoriesDisplay.languageAndIlliteracy
" "
class="list"
> >
<div *ngFor="let public of structure.categoriesDisplay.languageAndIlliteracy" class="list"> <app-v3-tag-item
<p>{{ public }}</p> *ngFor="let public of structure.categoriesDisplay.languageAndIlliteracy"
</div> [label]="public"
</ng-container> [color]="'red'"
[clickable]="false"
[size]="'small'"
/>
</div>
</div> </div>
<div class="content"> <div class="content">
<ng-container <div
*ngIf=" *ngIf="
isFieldValid('handicaps', 'categories') && isFieldValid('handicaps', 'categories') &&
structure.categoriesDisplay && structure.categoriesDisplay &&
structure.categoriesDisplay.handicaps structure.categoriesDisplay.handicaps
" "
class="list"
> >
<div *ngFor="let public of structure.categoriesDisplay.handicaps" class="list"> <app-v3-tag-item
<p>{{ public }}</p> *ngFor="let public of structure.categoriesDisplay.handicaps"
</div> [label]="public"
</ng-container> [color]="'red'"
[clickable]="false"
[size]="'small'"
/>
</div>
</div> </div>
<div class="content"> <div class="content">
<ng-container <div
*ngIf=" *ngIf="
isFieldValid('genre', 'categories') && structure.categoriesDisplay && structure.categoriesDisplay.genre isFieldValid('genre', 'categories') && structure.categoriesDisplay && structure.categoriesDisplay.genre
" "
class="list"
> >
<div *ngFor="let public of structure.categoriesDisplay.genre" class="list"> <app-v3-tag-item
<p>{{ public }}</p> *ngFor="let public of structure.categoriesDisplay.genre"
</div> [label]="public"
</ng-container> [color]="'red'"
[clickable]="false"
[size]="'small'"
/>
</div>
</div> </div>
<div class="content"> <div class="content">
<ng-container <ng-container
......
...@@ -87,7 +87,8 @@ ...@@ -87,7 +87,8 @@
} }
.list { .list {
margin-bottom: 8px; display: flex;
gap: 0.5rem;
p { p {
display: list-item; display: list-item;
margin: 0 0 0 25px; margin: 0 0 0 25px;
......
...@@ -30,8 +30,12 @@ ...@@ -30,8 +30,12 @@
<!-- TODO link to structure --> <!-- TODO link to structure -->
<div class="structureDetails"> <div class="structureDetails">
<h2 class="structureName">{{ elt.structure.structureName }}</h2> <h2 class="structureName">{{ elt.structure.structureName }}</h2>
<!-- TODO update this tag to RED --> <app-v3-tag-item
<app-v3-tag-item [clickable]="false" [label]="elt.structure.structureType.category" [size]="'small'" /> [clickable]="false"
[label]="elt.structure.structureType.value"
[size]="'small'"
[color]="'red'"
/>
<div *ngIf="isBeingDeleted(elt.structure)" class="deleteInProgress"> <div *ngIf="isBeingDeleted(elt.structure)" class="deleteInProgress">
<app-svg-icon [iconClass]="'icon-20'" [type]="'tags'" [icon]="'warning'" /> <app-svg-icon [iconClass]="'icon-20'" [type]="'tags'" [icon]="'warning'" />
<span <span
......
...@@ -24,7 +24,6 @@ export const Input: Story = { ...@@ -24,7 +24,6 @@ export const Input: Story = {
args: { args: {
id: 'input1', id: 'input1',
label: 'Label', label: 'Label',
value: '',
}, },
}; };
......
...@@ -22,8 +22,8 @@ button { ...@@ -22,8 +22,8 @@ button {
padding-inline: 12px; padding-inline: 12px;
} }
// STATE EFFECTS / COLORS // COLORS
&.clickable { &.white {
background-color: $white; background-color: $white;
border-color: $grey-5; border-color: $grey-5;
color: $grey-1; color: $grey-1;
...@@ -52,10 +52,18 @@ button { ...@@ -52,10 +52,18 @@ button {
} }
} }
&.unclickable { &.red {
cursor: default; color: $red-darker;
background-color: $red-light;
}
&.black {
color: $white;
background-color: $grey-1; background-color: $grey-1;
border-color: $grey-1; border-color: $grey-1;
color: $white; }
&.unclickable {
cursor: default;
} }
} }
...@@ -7,13 +7,13 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; ...@@ -7,13 +7,13 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
}) })
export class TagItemV3Component { export class TagItemV3Component {
/** Tag label */ /** Tag label */
@Input() label = 'Bouton'; @Input({ required: true }) label: string;
/** How large should be the button ? */ /** How large should be the button ? */
@Input() size?: 'small' | 'medium' = 'medium'; @Input() size?: 'small' | 'medium' = 'medium';
/** Is the tag selected ? */ /** What color should the tag be ? */
@Input() selected = false; @Input() color?: 'white' | 'black' | 'red' = 'white';
/** Should the button be clickable ? */ /** Should the button be clickable ? */
@Input() clickable = true; @Input() clickable = true;
...@@ -34,7 +34,7 @@ export class TagItemV3Component { ...@@ -34,7 +34,7 @@ export class TagItemV3Component {
@Output() action = new EventEmitter<Event>(); @Output() action = new EventEmitter<Event>();
public get classes(): string[] { public get classes(): string[] {
return [this.size, this.selected ? 'selected' : '', this.clickable ? 'clickable' : 'unclickable']; return [this.size, this.color, this.clickable ? 'clickable' : 'unclickable'];
} }
public get iconSize(): 'icon-12' | 'icon-16' { public get iconSize(): 'icon-12' | 'icon-16' {
......
...@@ -22,69 +22,80 @@ const meta: Meta<TagItemV3Component> = { ...@@ -22,69 +22,80 @@ const meta: Meta<TagItemV3Component> = {
export default meta; export default meta;
type Story = StoryObj<TagItemV3Component>; type Story = StoryObj<TagItemV3Component>;
export const SmallTag: Story = { export const Small: Story = {
args: { args: {
label: 'Label tag', label: 'Label tag',
size: 'small', size: 'small',
clickable: true,
disabled: false,
selected: false,
action: new EventEmitter(), action: new EventEmitter(),
}, },
}; };
export const SmallTagWithIcon: Story = { export const SmallWithIcon: Story = {
args: { args: {
...SmallTag.args, ...Small.args,
iconFolder: 'ico', iconFolder: 'ico',
iconName: 'email', iconName: 'email',
}, },
}; };
export const SmallTagSelected: Story = { export const Medium: Story = {
args: { args: {
...SmallTag.args, label: 'Medium tag',
selected: true, color: 'white',
size: 'medium',
}, },
}; };
export const MediumTag: Story = { export const MediumSelected: Story = {
args: { args: {
label: 'Medium tag', label: 'Medium tag',
color: 'black',
size: 'medium', size: 'medium',
iconFolder: 'ico',
iconName: 'mail',
}, },
}; };
export const MediumTagWithIcon: Story = { export const MediumRed: Story = {
args: { args: {
...MediumTag.args, label: 'Médiathèque/Bibliothèque',
iconFolder: 'ico', color: 'red',
iconName: 'email', size: 'medium',
clickable: false,
}, },
}; };
export const Unclickable: Story = { export const MediumBlack: Story = {
args: { args: {
label: 'Unclickable tag', label: 'Médiathèque/Bibliothèque',
clickable: false, color: 'black',
size: 'medium',
}, },
}; };
export const UnclickableWithIcon: Story = { export const MediumWithIcon: Story = {
args: { args: {
...Unclickable.args, ...Medium.args,
iconFolder: 'ico', iconFolder: 'ico',
iconName: 'email', iconName: 'email',
}, },
}; };
export const Unclickable: Story = {
args: {
label: 'Unclickable tag',
clickable: false,
},
};
export const MultipleTags: Story = { export const MultipleTags: Story = {
render: (args) => ({ render: (args) => ({
props: args, props: args,
template: ` template: `
<div class="btn-grid"> <div class="btn-grid">
<app-v3-tag-item label="test 1" /> <app-v3-tag-item label="test 1" />
<app-v3-tag-item label="test 2" selected="true" /> <app-v3-tag-item label="test 2" />
<app-v3-tag-item label="test 3" /> <app-v3-tag-item label="test 3" />
</div>`, </div>`,
}), }),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment