Skip to content

Commit

Permalink
feat: move duplicated alert and toast enums to the common folder (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinderoubaix authored Sep 19, 2024
1 parent f847794 commit 9b50c0b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 69 deletions.
12 changes: 1 addition & 11 deletions angular/demo/bootstrap/src/app/samples/alert/config.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@ import {AgnosUIAngularModule} from '@agnos-ui/angular-bootstrap';
import type {AlertComponent} from '@agnos-ui/angular-bootstrap';
import {Component, signal} from '@angular/core';
import {FormsModule} from '@angular/forms';

export enum AlertStatus {
success = 'success',
info = 'info',
warning = 'warning',
danger = 'danger',
primary = 'primary',
secondary = 'secondary',
light = 'light',
dark = 'dark',
}
import {AlertStatus} from '@agnos-ui/common/samples/alert/alert-status.enum';

@Component({
standalone: true,
Expand Down
13 changes: 1 addition & 12 deletions angular/demo/bootstrap/src/app/samples/toast/dynamic.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@ import type {ToastProps} from '@agnos-ui/angular-bootstrap';
import {AgnosUIAngularModule, ToastComponent} from '@agnos-ui/angular-bootstrap';
import {Component, Injectable, inject, signal} from '@angular/core';
import {FormsModule} from '@angular/forms';

export enum ToastPositions {
topLeft = 'top-0 start-0',
topCenter = 'top-0 start-50 translate-middle-x',
topRight = 'top-0 end-0',
middleLeft = 'top-50 start-0 translate-middle-y',
middleCenter = 'top-50 start-50 translate-middle',
middleRight = 'top-50 end-0 translate-middle-y',
bottomLeft = 'bottom-0 start-0',
bottomCenter = 'bottom-0 start-50 translate-middle-x',
bottomRight = 'bottom-0 end-0',
}
import {ToastPositions} from '@agnos-ui/common/samples/toast/toast-positions.enum';

@Injectable({providedIn: 'root'})
class ToastService {
Expand Down
10 changes: 10 additions & 0 deletions common/samples/alert/alert-status.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export enum AlertStatus {
success = 'success',
info = 'info',
warning = 'warning',
danger = 'danger',
primary = 'primary',
secondary = 'secondary',
light = 'light',
dark = 'dark',
}
11 changes: 11 additions & 0 deletions common/samples/toast/toast-positions.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export enum ToastPositions {
topLeft = 'top-0 start-0',
topCenter = 'top-0 start-50 translate-middle-x',
topRight = 'top-0 end-0',
middleLeft = 'top-50 start-0 translate-middle-y',
middleCenter = 'top-50 start-50 translate-middle',
middleRight = 'top-50 end-0 translate-middle-y',
bottomLeft = 'bottom-0 start-0',
bottomCenter = 'bottom-0 start-50 translate-middle-x',
bottomRight = 'bottom-0 end-0',
}
12 changes: 1 addition & 11 deletions react/demo/src/bootstrap/samples/alert/Config.route.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import type {AlertApi, AlertProps} from '@agnos-ui/react-bootstrap/components/alert';
import {Alert} from '@agnos-ui/react-bootstrap/components/alert';
import {useRef, useState} from 'react';

export enum AlertStatus {
success = 'success',
info = 'info',
warning = 'warning',
danger = 'danger',
primary = 'primary',
secondary = 'secondary',
light = 'light',
dark = 'dark',
}
import {AlertStatus} from '@agnos-ui/common/samples/alert/alert-status.enum';

const DefaultDemo = () => {
const alertRef = useRef<AlertApi>(null);
Expand Down
13 changes: 1 addition & 12 deletions react/demo/src/bootstrap/samples/toast/Dynamic.route.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import type {ToastProps} from '@agnos-ui/react-bootstrap/components/toast';
import {Toast} from '@agnos-ui/react-bootstrap/components/toast';
import {useState} from 'react';

export enum ToastPositions {
topLeft = 'top-0 start-0',
topCenter = 'top-0 start-50 translate-middle-x',
topRight = 'top-0 end-0',
middleLeft = 'top-50 start-0 translate-middle-y',
middleCenter = 'top-50 start-50 translate-middle',
middleRight = 'top-50 end-0 translate-middle-y',
bottomLeft = 'bottom-0 start-0',
bottomCenter = 'bottom-0 start-50 translate-middle-x',
bottomRight = 'bottom-0 end-0',
}
import {ToastPositions} from '@agnos-ui/common/samples/toast/toast-positions.enum';

type ReactToastProps = Partial<ToastProps> & {id: number};

Expand Down
12 changes: 1 addition & 11 deletions svelte/demo/src/bootstrap/samples/alert/Config.route.svelte
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<script lang="ts">
import {Alert, type AlertProps} from '@agnos-ui/svelte-bootstrap/components/alert';
import {AlertStatus} from '@agnos-ui/common/samples/alert/alert-status.enum';
let alert: Alert;
let [animatedOnInit, animated, dismissible] = [true, true, true];
let type: AlertProps['type'] = 'success';
enum AlertStatus {
success = 'success',
info = 'info',
warning = 'warning',
danger = 'danger',
primary = 'primary',
secondary = 'secondary',
light = 'light',
dark = 'dark',
}
const styles = Object.entries(AlertStatus).map((entry) => {
return {
value: entry[1],
Expand Down
13 changes: 1 addition & 12 deletions svelte/demo/src/bootstrap/samples/toast/Dynamic.route.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
import {Toast} from '@agnos-ui/svelte-bootstrap/components/toast';
import type {ToastProps} from '@agnos-ui/svelte-bootstrap/components/toast';
import {writable} from 'svelte/store';
enum ToastPositions {
topLeft = 'top-0 start-0',
topCenter = 'top-0 start-50 translate-middle-x',
topRight = 'top-0 end-0',
middleLeft = 'top-50 start-0 translate-middle-y',
middleCenter = 'top-50 start-50 translate-middle',
middleRight = 'top-50 end-0 translate-middle-y',
bottomLeft = 'bottom-0 start-0',
bottomCenter = 'bottom-0 start-50 translate-middle-x',
bottomRight = 'bottom-0 end-0',
}
import {ToastPositions} from '@agnos-ui/common/samples/toast/toast-positions.enum';
const positions = Object.entries(ToastPositions).map((entry) => {
return {
Expand Down

0 comments on commit 9b50c0b

Please sign in to comment.