Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add demo before code and refactor components related to UI #451

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions apps/demo/src/assets/css/demoPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
.demo > .demo-main {
flex-basis: 0;
flex-grow: 999;
height: 100%;
padding-block: var(--layout-default-padding-v, 2.5rem);
padding-inline: var(--layout-default-padding-v, 2rem);
}

.demo-aside {
Expand All @@ -19,7 +22,9 @@
--_position: relative;
--_width: 100%;

padding-right: 2rem;
flex-basis: 17rem;
flex-grow: 1;
overflow: unset;
}

.demo-aside .link.active,
Expand All @@ -38,16 +43,28 @@
border-bottom: none;
}

.layout > main:has(.demo) {
padding: 0;
}

@media screen and (min-width: 576px) {
.demo {
flex-direction: row;
}

.demo-aside {
--_width: 15rem;
--_border-color: var(--border-color, #dee2e6);
--_position: sticky;
--_width: 15rem;

min-width: var(--_width);
border-right: 1px solid var(--_border-color);
height: 100%;
min-width: var(--_width);
overflow-y: auto;
padding: 1rem 2rem;
}

.demo > .demo-main {
overflow-y: auto;
}
}
1 change: 1 addition & 0 deletions apps/demo/src/assets/css/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ section:has(h3) {
.demo .section-content {
display: grid;
gap: 1.5em;
margin-top: 1em;
}

.ssh-pre {
Expand Down
120 changes: 60 additions & 60 deletions apps/demo/src/views/UI/badge/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<h2>{{ $t("ui.badge.usage.basic") }}</h2>

<div class="section-content">
<BadgeComponent :label="$t('ui.badge.label.basic')" />

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
Expand All @@ -21,15 +23,15 @@
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<BadgeComponent :label="$t('ui.badge.label.basic')" />
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.withI18n") }}</h2>

<div class="section-content">
<BadgeComponent :label="$t('ui.badge.label.addedIn')" />

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
Expand All @@ -44,15 +46,15 @@
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<BadgeComponent :label="$t('ui.badge.label.addedIn')" />
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.rounded") }}</h2>

<div class="section-content">
<BadgeComponent :label="$t('ui.badge.label.rounded')" rounded />

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
Expand All @@ -64,32 +66,13 @@
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<BadgeComponent :label="$t('ui.badge.label.rounded')" rounded />
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.severity") }}</h2>

<div class="section-content">
<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
&lt;Badge label="Primary" severity="primary" /&gt;
&lt;Badge label="Secondary" severity="secondary" /&gt;
&lt;Badge label="Alternate" severity="alternate" /&gt;
&lt;Badge label="Success" severity="success" /&gt;
&lt;Badge label="Danger" severity="danger" /&gt;
&lt;Badge label="Warning" severity="warning" /&gt;
&lt;/template&gt;

&lt;script setup lang="ts"&gt;
import { Badge } from "@dzangolab/vue3-ui";
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<div class="container">
<BadgeComponent
:label="$t('ui.badge.label.primary')"
Expand All @@ -116,50 +99,54 @@
severity="warning"
/>
</div>
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.icon") }}</h2>

<div class="section-content">
<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
&lt;Badge icon-left="pi pi-thumbs-up" /&gt;
&lt;Badge icon-right="pi pi-thumbs-down" /&gt;
&lt;Badge label="Primary" severity="primary" /&gt;
&lt;Badge label="Secondary" severity="secondary" /&gt;
&lt;Badge label="Alternate" severity="alternate" /&gt;
&lt;Badge label="Success" severity="success" /&gt;
&lt;Badge label="Danger" severity="danger" /&gt;
&lt;Badge label="Warning" severity="warning" /&gt;
&lt;/template&gt;

&lt;script setup lang="ts"&gt;
import { Badge } from "@dzangolab/vue3-ui";
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<div class="container">
<BadgeComponent icon-left="pi pi-thumbs-up" />
<BadgeComponent icon-right="pi pi-thumbs-down" />
</div>
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.iconPackage") }}</h2>
<h2>{{ $t("ui.badge.usage.icon") }}</h2>

<div class="section-content">
<div class="container">
<BadgeComponent icon-left="pi pi-thumbs-up" />
<BadgeComponent icon-right="pi pi-thumbs-down" />
</div>

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
&lt;Badge label="Locked" icon-left="pi pi-lock" /&gt;
&lt;Badge label="Unlocked" icon-right="fa-solid fa-lock-open" severity="success /&gt;
&lt;Badge icon-left="pi pi-thumbs-up" /&gt;
&lt;Badge icon-right="pi pi-thumbs-down" /&gt;
&lt;/template&gt;

&lt;script setup lang="ts"&gt;
import { Badge } from "@dzangolab/vue3-ui";
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.iconPackage") }}</h2>

<div class="section-content">
<div class="container">
<BadgeComponent
:label="$t('ui.badge.label.locked')"
Expand All @@ -172,26 +159,26 @@
severity="success"
/>
</div>
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.iconAndLabel") }}</h2>

<div class="section-content">
<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
&lt;Badge label="Locked" icon-left="pi pi-lock" /&gt;
&lt;Badge label="Unlocked" icon-right="pi pi-lock-open" severity="success /&gt;
&lt;Badge label="Unlocked" icon-right="fa-solid fa-lock-open" severity="success /&gt;
&lt;/template&gt;

&lt;script setup lang="ts"&gt;
import { Badge } from "@dzangolab/vue3-ui";
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.iconAndLabel") }}</h2>

<div class="section-content">
<div class="container">
<BadgeComponent
:label="$t('ui.badge.label.locked')"
Expand All @@ -204,13 +191,40 @@
severity="success"
/>
</div>

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
&lt;Badge label="Locked" icon-left="pi pi-lock" /&gt;
&lt;Badge label="Unlocked" icon-right="pi pi-lock-open" severity="success /&gt;
&lt;/template&gt;

&lt;script setup lang="ts"&gt;
import { Badge } from "@dzangolab/vue3-ui";
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->
</div>
</section>

<section>
<h2>{{ $t("ui.badge.usage.iconElement") }}</h2>

<div class="section-content">
<div class="container">
<BadgeComponent :label="$t('ui.badge.label.correct')">
<template #iconLeft>
<i class="pi pi-check" />
</template>
</BadgeComponent>

<BadgeComponent :label="$t('ui.badge.label.wrong')" severity="danger">
<template #iconRight>
<i class="pi pi-times" />
</template>
</BadgeComponent>
</div>

<!-- eslint-disable -->
<SshPre language="html-vue">
&lt;template&gt;
Expand All @@ -232,20 +246,6 @@
&lt;/script&gt;
</SshPre>
<!-- eslint-enable -->

<div class="container">
<BadgeComponent :label="$t('ui.badge.label.correct')">
<template #iconLeft>
<i class="pi pi-check" />
</template>
</BadgeComponent>

<BadgeComponent :label="$t('ui.badge.label.wrong')" severity="danger">
<template #iconRight>
<i class="pi pi-times" />
</template>
</BadgeComponent>
</div>
</div>
</section>
</UiPage>
Expand Down
Loading
Loading