forked from AmadeusITGroup/AgnosUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Demo): Add alert for beta/progress components closes AmadeusITGr…
- Loading branch information
1 parent
1eec186
commit 4a55ce0
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters