Skip to content

Commit

Permalink
feat(Demo): Add alert for beta/progress components closes AmadeusITGr…
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinNelu committed Feb 27, 2024
1 parent 1eec186 commit 4a55ce0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
42 changes: 42 additions & 0 deletions demo/src/lib/layout/StatusAlert.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script lang="ts">
import {Alert} from '@agnos-ui/svelte/components/alert';
import biInfoCircleFill from 'bootstrap-icons/icons/info-circle-fill.svg?raw';
import biExclamationTriangleFill from 'bootstrap-icons/icons/exclamation-triangle-fill.svg?raw';
import {page} from '$app/stores';
const regex = /\/(components|services)\/([^\/]+)/;
const typeIcon: Record<string, string> = {
info: biInfoCircleFill,
warning: biExclamationTriangleFill,
};
export let status: string;
let alert: Alert;
$: type = status === 'inprogress' ? 'warning' : 'info';
$: statusText = status === 'inprogress' ? 'In progress' : 'Beta';
$: statusTextBody =
status === 'inprogress'
? 'This component is still under active development. More features will be added in the near future.'
: 'This component has all the basic functionalities implemented. More polishing features might be added in the near future.';
$: componentName = $page.url.pathname.match(regex)?.[2];
$: issueUrl = `https://github.com/AmadeusITGroup/AgnosUI/issues?q=is%3Aopen+is%3Aissue+label%3A%22widget%3A+${componentName}%22`;
$: {
componentName;
alert?.api.open();
}
</script>

<Alert bind:this={alert} {type} className="p-0 border-0 border-start border-5 border-{type}">
<div class="alert-container p-3 border border-{type} rounded-end">
<div class="d-flex align-items-center">
<span class="d-flex me-2">{@html typeIcon[type]}</span>
Warning: component is <strong class="ms-1"> {statusText}</strong><br />
</div>
<hr />
{statusTextBody}
<br />
If you want to contribute, please visit
<a href={issueUrl} target="_blank">the issues on GitHub</a>.
</div>
</Alert>
4 changes: 4 additions & 0 deletions demo/src/routes/docs/[framework]/components/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import Header from '$lib/layout/Header.svelte';
import StatusAlert from '$lib/layout/StatusAlert.svelte';
import {selectedFramework$, selectedTabName$} from '$lib/stores';
Expand All @@ -17,5 +18,8 @@

<Header title={$page.data.title} status={$page.data.status} />
<div class="main-content">
{#if $page.data.status !== 'stable'}
<StatusAlert status={$page.data.status} />
{/if}
<slot />
</div>

0 comments on commit 4a55ce0

Please sign in to comment.