Skip to content

Commit

Permalink
docs: wt-navigation-bar docs + colors change [WTEL-3943]
Browse files Browse the repository at this point in the history
  • Loading branch information
dlohvinov committed Nov 30, 2023
1 parent a691da3 commit 71687b4
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 84 deletions.
7 changes: 7 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme';
import { createRouter, createWebHistory } from 'vue-router';
import WebitelUI from '../../../src/install.js';
import i18n from '../../../src/locale/i18n';
import sharedComponents from '../../shared';
import '../../../src/assets//icons/sprite';
import 'prismjs/themes/prism.min.css';
import Layout from './Layout.vue';

const router = createRouter({
history: createWebHistory(),
routes: [],
});

/** @type {import('vitepress').Theme} */
export default {
extends: DefaultTheme,
Layout,
enhanceApp({ app }) {
app.use(i18n);
app.use(router); // for wt-navigation-bar docs
WebitelUI.install(app, {});
Object.keys(sharedComponents).forEach((name) => {
app.component(name, sharedComponents[name]);
Expand Down
21 changes: 21 additions & 0 deletions docs/pages/webitel-ui/components/wt-divider/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup>
import Docs from './wt-divider-docs.vue';
import ExampleDivider from './examples/example-divider.vue';
</script>

# WtDivider

## Props
::: raw
<Docs/>
:::

## Example Divider
::: raw
<ExampleDivider/>
:::

::: details Code
<<< ./examples/example-divider.vue
:::

20 changes: 20 additions & 0 deletions docs/pages/webitel-ui/components/wt-navigation-bar/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script setup>
import Docs from './wt-navigation-bar-docs.vue';
import ExampleNavigationBar from './examples/example-navigation-bar.vue';
</script>

# WtNavigationBar

## Props
::: raw
<Docs/>
:::

## Example NavigationBar
::: raw
<ExampleNavigationBar/>
:::

::: details Code
<<< ./examples/example-navigation-bar.vue
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script setup>
const currentApp = 'history';
const nav = [
{ value: '1', name: 'Name 1', route: '/1' },
{
value: 'exp1', name: 'Expansion 1', subNav: [
{ value: '2', name: 'Name 2', route: '/2' },
{ value: '3', name: 'Name 3', route: '/3' },
],
},
{
value: 'exp2', name: 'Expansion 2', subNav: [
{ value: '4', name: 'Name 4', route: '/4' },
{ value: '5', name: 'Name 5', route: '/5' },
],
},
];
</script>

<template>
<wt-navigation-bar
:current-app="currentApp"
:nav="nav"
/>
</template>

<style scoped lang="scss">
.wt-navigation-bar :deep(.wt-navigation-bar__nav) {
z-index: 1001; // overlap vitepress sidebar
}
</style>
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
<template>
<section>
<h2>Navigation bar</h2>
<article>
<div class="example-wrapper">
<wt-navigation-bar
:current-app="'history'"
:nav="[
{ value: '1', name: 'Name 1', route: '/1' },
{ value: 'exp1', name: 'Expansion 1', subNav: [
{ value: '2', name: 'Name 2', route: '/2' },
{ value: '3', name: 'Name 3', route: '/3' },
] },
{ value: 'exp2', name: 'Expansion 2', subNav: [
{ value: '4', name: 'Name 4', route: '/4' },
{ value: '5', name: 'Name 5', route: '/5' },
] },
]"
/>
<pre><code
class="language-html"
>
&lt;wt-navigation-bar
:current-app="'history'"
:nav="[
{ value: '1', name: 'Name 1', route: '/1' },
{ value: 'exp1', name: 'Expansion 1', subNav: [
{ value: '2', name: 'Name 2', route: '/2' },
{ value: '3', name: 'Name 3', route: '/3' },
] },
{ value: 'exp2', name: 'Expansion 2', subNav: [
{ value: '4', name: 'Name 4', route: '/4' },
{ value: '5', name: 'Name 5', route: '/5' },
] },
]"
&gt;&lt;/wt-navigation-bar&gt;
</code></pre>
</div>
</article>
<component-props
:properties="properties"
/>
</section>
<component-props
:properties="properties"
/>
</template>

<script>
Expand Down
4 changes: 2 additions & 2 deletions src/components/wt-divider/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

:root {
--divider-border: 1px solid;
--divider-border-color: var(--page-bg-color);
}
--divider-border-color: var(--secondary-color);
}
30 changes: 18 additions & 12 deletions src/components/wt-navigation-bar/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
:root {
--navigation-bar-width: 340px;
--navigation-bar-z-index: 10;
--navigation-bar-bg-color: var(--main-color);
--navigation-bar-padding: var(--spacing-sm);
--wt-navigation-bar-width: 340px;
--wt-navigation-bar-z-index: 10;
--wt-navigation-bar-padding: var(--spacing-sm);

--navigation-bar-header-padding: var(--spacing-xs);
--navigation-bar-app-pic-width: 200px;
--navigation-bar-app-pic-height: 30px;
--wt-navigation-bar-header-padding: var(--spacing-xs);
--wt-navigation-bar-app-pic-width: 200px;
--wt-navigation-bar-app-pic-height: 30px;

--navigation-bar-list-padding: var(--navigation-bar-padding);
--navigation-bar-link-padding: var(--navigation-bar-padding);
--navigation-bar-subnav-padding-left: var(--spacing-lg);
--navigation-bar-active-expansion-flag-width: 5px;
--navigation-bar-active-expansion-name-max-width: calc(100% - var(--icon-md-size) - var(--spacing-xs));
--wt-navigation-bar-list-padding: var(--wt-navigation-bar-padding);
--wt-navigation-bar-link-padding: var(--wt-navigation-bar-padding);
--wt-navigation-bar-subnav-padding-left: var(--spacing-lg);
--wt-navigation-bar-active-expansion-flag-width: 5px;
--wt-navigation-bar-active-expansion-name-max-width: calc(100% - var(--icon-md-size) - var(--spacing-xs));

--wt-navigation-bar-background-color: var(--dp-18-surface-color);
--wt-navigation-bar-option-text-color: var(--text-main-color);
--wt-navigation-bar-option-background-color: var(--dp-18-surface-color);
--wt-navigation-bar-option-background-hover-color: var(--dp-20-surface-color);
--wt-navigation-bar-option-background-active-color: var(--primary-light-color);
--wt-navigation-bar-expansion-ribbon-color: var(--primary-color);
}
32 changes: 17 additions & 15 deletions src/components/wt-navigation-bar/wt-navigation-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ export default {
.wt-navigation-bar__nav {
@extend %wt-scrollbar;
position: fixed;
z-index: var(--navigation-bar-z-index);
z-index: var(--wt-navigation-bar-z-index);
top: 0;
bottom: 0;
left: 0;
overflow: auto;
width: var(--navigation-bar-width);
padding: var(--navigation-bar-padding);
width: var(--wt-navigation-bar-width);
padding: var(--wt-navigation-bar-padding);
border-radius: var(--border-radius);
background: var(--navigation-bar-bg-color);
background: var(--wt-navigation-bar-background-color);
box-shadow: var(--elevation-10);
// expand animation optimization
Expand All @@ -217,27 +217,28 @@ export default {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--navigation-bar-header-padding);
padding: var(--wt-navigation-bar-header-padding);
}
.wt-navigation-bar__app-pic {
width: var(--navigation-bar-app-pic-width);
height: var(--navigation-bar-app-pic-height);
width: var(--wt-navigation-bar-app-pic-width);
height: var(--wt-navigation-bar-app-pic-height);
}
.wt-navigation-bar__nav-item-link {
@extend %typo-body-1;
display: block;
padding: var(--navigation-bar-link-padding);
padding: var(--wt-navigation-bar-link-padding);
transition: var(--transition);
word-wrap: break-word;
color: var(--wt-navigation-bar-option-text-color);
&:hover {
background: var(--accent-secondary-color);
background: var(--wt-navigation-bar-option-background-hover-color);
}
&--active {
background: var(--accent-secondary-color);
background: var(--wt-navigation-bar-option-background-active-color);
}
}
Expand All @@ -248,20 +249,21 @@ export default {
align-items: center;
justify-content: space-between;
width: 100%;
padding: var(--navigation-bar-link-padding);
padding: var(--wt-navigation-bar-link-padding);
outline: none;
color: var(--wt-navigation-bar-option-text-color);
&:before {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: var(--navigation-bar-active-expansion-flag-width);
width: var(--wt-navigation-bar-active-expansion-flag-width);
content: '';
transition: var(--transition);
opacity: 0;
border-radius: var(--border-radius);
background: var(--primary-color);
background: var(--wt-navigation-bar-expansion-ribbon-color);
}
.wt-navigation-bar__expansion-arrow {
Expand All @@ -280,11 +282,11 @@ export default {
.wt-navigation-bar__nav-expansion-name {
display: block;
max-width: var(--navigation-bar-active-expansion-name-max-width);
max-width: var(--wt-navigation-bar-active-expansion-name-max-width);
word-wrap: break-word;
}
.wt-navigation-bar__nav-item-link--subnav {
padding-left: var(--navigation-bar-subnav-padding-left);
padding-left: var(--wt-navigation-bar-subnav-padding-left);
}
</style>
14 changes: 7 additions & 7 deletions src/components/wt-notification/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

:root {
--notification-min-width: 30vw;
--notification-max-width: 40vw;
--notification-padding: var(--spacing-xs);
--notification-icon-margin: var(--spacing-xs);
--wt-notification-min-width: 30vw;
--wt-notification-max-width: 40vw;
--wt-notification-padding: var(--spacing-xs);
--wt-notification-icon-margin: var(--spacing-xs);

--notification-text-color: var(--text-primary-color);
--notification-bg-color: var(--main-color);
}
--wt-notification-text-color: var(--text-primary-color);
--wt-notification-bg-color: var(--main-color);
}
12 changes: 6 additions & 6 deletions src/components/wt-notification/wt-notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ export default {
position: relative;
display: flex;
align-items: flex-start;
min-width: var(--notification-min-width);
max-width: var(--notification-max-width);
padding: var(--notification-padding);
color: var(--notification-text-color);
background: var(--notification-bg-color);
min-width: var(--wt-notification-min-width);
max-width: var(--wt-notification-max-width);
padding: var(--wt-notification-padding);
color: var(--wt-notification-text-color);
background: var(--wt-notification-bg-color);
border-radius: var(--border-radius);
box-shadow: var(--elevation-1);
cursor: pointer;
}
.wt-notification__icon {
flex: 0 0 var(--icon-md-size);
margin-right: var(--notification-icon-margin);
margin-right: var(--wt-notification-icon-margin);
}
.wt-notification__text {
Expand Down

0 comments on commit 71687b4

Please sign in to comment.