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

feat(empty-state): added empty-state (#DS-2572) #129

Merged
merged 8 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: added examples
  • Loading branch information
lskramarov committed Jul 12, 2024
commit 1fb82f6694a73d49c9cb048f894fe7009b3dc9c9
9 changes: 9 additions & 0 deletions apps/docs/src/app/components/documentation-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ const DOCS: { [key: string]: DocCategory[] } = {
hasExamples: false,
examples: ['dropdown-types']
},
{
id: 'empty-state',
name: 'Empty state',
svgPreview: 'empty-state',
hasApi: true,
apiId: 'empty-state',
hasExamples: false,
examples: ['empty-state-types']
},
{
id: 'icon',
name: 'Icon',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions packages/components/empty-state/empty-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Компонент-заглушка для пустых состояний или сообщений об ошибке. Рамка не является частью компонента, а показана только для иллюстраций к статье.

<!-- example(empty-state-default) -->
### Size

Для заглушек на весь экран можно использовать блок с элементами увеличенного размера

<!-- example(empty-state-big) -->

### Align

Содержимое может быть выровнено по центру или по верхнеу краю

<!-- example(empty-state-align) -->

### Error

Компонент Empty State можно использовать для показа сообщения об ошибке. В этом состоянии текст становится красным.

<!-- example(empty-state-error) -->

### Content
#### Иллюстрация

Размер иллюстрации можно менять. Иллюстрация большого размера подойдет для полноэкранных заглушек. Если нужна заглушка лишь для отдельного блока, то можно сделать иллюстрацию компактной или вовсе отказаться от нее.

<!-- example(empty-state-content) -->

В компоненте с центральным выраниванием и иллюстрацией появляется дополнительный нижний отступ, который поднимает копозицию выше для оптической компенсации.

### Иконка

В качестве иллюстрации можно вставить иконку

<!-- example(empty-state-icon) -->

### Заголовок

<!-- example(empty-state-title) -->

### Действия

Под тектом можно разместить одно или несколько действий: кнопки, ссылки и псевдоссылки.

<!-- example(empty-state-actions) -->

<!-- example(empty-state-actions2) -->

### Только текст

<!-- example(empty-state-text-only) -->
2 changes: 1 addition & 1 deletion packages/components/empty-state/empty-state.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
flex-direction: column;
align-items: center;

height: 100%;
flex: 1;

&.kbq-empty-state_normal {
padding:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<kbq-empty-state>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div class="layout-row layout-align-center" kbq-empty-state-actions style="min-width: 340px">
<button class="layout-margin-right-s" kbq-button [kbqStyle]="styles.Filled" [color]="colors.Contrast">
Создать группу
</button>

<button kbq-button [kbqStyle]="styles.Filled" [color]="colors.ContrastFade">
Объединить группы
</button>
</div>
</kbq-empty-state>

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { KbqButtonStyles } from '@koobiq/components/button';
import { KbqComponentColors } from '@koobiq/components/core';


/**
* @title empty-state-actions
*/
@Component({
selector: 'empty-state-actions-example',
templateUrl: 'empty-state-actions-example.html',
styleUrls: ['empty-state-actions-example.css']
})
export class EmptyStateActionsExample {
readonly styles = KbqButtonStyles;
readonly colors = KbqComponentColors;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<kbq-empty-state>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">
Action 1
</button>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">
Action 2
</button>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">
Action 3
</button>
</div>
</kbq-empty-state>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { KbqButtonStyles } from '@koobiq/components/button';
import { KbqComponentColors } from '@koobiq/components/core';


/**
* @title empty-state-actions2
*/
@Component({
selector: 'empty-state-actions2-example',
templateUrl: 'empty-state-actions2-example.html',
styleUrls: ['empty-state-actions2-example.css']
})
export class EmptyStateActions2Example {
readonly styles = KbqButtonStyles;
readonly colors = KbqComponentColors;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.docs-empty-state-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

.docs-empty-state-container .kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="docs-empty-state-container">
<kbq-empty-state class="flex">
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">+ Создать группу</button>
</div>
</kbq-empty-state>

<kbq-empty-state class="flex" [alignTop]="true">
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">+ Создать группу</button>
</div>
</kbq-empty-state>
</div>



Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { KbqButtonStyles } from '@koobiq/components/button';
import { KbqComponentColors } from '@koobiq/components/core';


/**
* @title empty-state-align
*/
@Component({
selector: 'empty-state-align-example',
templateUrl: 'empty-state-align-example.html',
styleUrls: ['empty-state-align-example.css']
})
export class EmptyStateAlignExample {
readonly colors = KbqComponentColors;
readonly styles = KbqButtonStyles;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<kbq-empty-state [big]="true">
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="'transparent'" [color]="'theme'">+ Создать группу</button>
</div>
</kbq-empty-state>


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';


/**
* @title empty-state-big
*/
@Component({
selector: 'empty-state-big-example',
templateUrl: 'empty-state-big-example.html',
styleUrls: ['empty-state-big-example.css']
})
export class EmptyStateBigExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.docs-empty-state-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

.docs-empty-state-container .kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="docs-empty-state-container">
<kbq-empty-state class="flex">
<div kbq-empty-state-icon>
<img src="assets/images/empty-state/4_Empty_F_1psW.png" width="192" height="192">
</div>
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">
<i kbq-icon="mc-plus_16"></i>
+ Создать группу
</button>
</div>
</kbq-empty-state>

<kbq-empty-state class="flex">
<div kbq-empty-state-icon>
<img src="assets/images/empty-state/4_Empty_F_1psW.png" width="80" height="80">
</div>
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="styles.Transparent" [color]="colors.Theme">
<i kbq-icon="mc-plus_16"></i>
+ Создать группу
</button>
</div>
</kbq-empty-state>
</div>



Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { KbqButtonStyles } from '@koobiq/components/button';
import { KbqComponentColors } from '@koobiq/components/core';


/**
* @title empty-state-content
*/
@Component({
selector: 'empty-state-content-example',
templateUrl: 'empty-state-content-example.html',
styleUrls: ['empty-state-content-example.css']
})
export class EmptyStateContentExample {
readonly colors = KbqComponentColors;
readonly styles = KbqButtonStyles;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<kbq-empty-state>
<div kbq-empty-state-title>Нет групп</div>
<div kbq-empty-state-text>Агенты можно объединить в группу и назначить им одни и те же политики</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="'transparent'" [color]="'theme'">+ Создать группу</button>
</div>
</kbq-empty-state>


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';


/**
* @title empty-state-default
*/
@Component({
selector: 'empty-state-default-example',
templateUrl: 'empty-state-default-example.html',
styleUrls: ['empty-state-default-example.css']
})
export class EmptyStateDefaultExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<kbq-empty-state [errorColor]="true">
<i kbq-icon-item="mc-error_16" [fade]="true" [big]="true" [color]="'contrast'" kbq-empty-state-icon></i>
<div kbq-empty-state-title>Не удалось показать записи</div>
<div kbq-empty-state-text>Проблема с сетью или подключением к БД. Попробуйте еще раз или обратитесь к администратору.</div>
<div kbq-empty-state-actions>
<button kbq-button [kbqStyle]="'transparent'" [color]="'theme'">Обновить</button>
</div>
</kbq-empty-state>


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';


/**
* @title empty-state-error
*/
@Component({
selector: 'empty-state-error-example',
templateUrl: 'empty-state-error-example.html',
styleUrls: ['empty-state-error-example.css']
})
export class EmptyStateErrorExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<kbq-empty-state>
<div kbq-empty-state-icon>
<i kbq-icon-item="mc-info_16" [fade]="true" [big]="true" [color]="'contrast'"></i>
</div>
<div kbq-empty-state-text>This should detail the actions you can take on this screen, as well as why it’s valuable.</div>
</kbq-empty-state>

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';


/**
* @title empty-state-icon
*/
@Component({
selector: 'empty-state-icon-example',
templateUrl: 'empty-state-icon-example.html',
styleUrls: ['empty-state-icon-example.css']
})
export class EmptyStateIconExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<kbq-empty-state>
<div kbq-empty-state-text>Нет информации</div>
</kbq-empty-state>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { KbqButtonStyles } from '@koobiq/components/button';
import { KbqComponentColors } from '@koobiq/components/core';


/**
* @title empty-state-text-only
*/
@Component({
selector: 'empty-state-text-only-example',
templateUrl: 'empty-state-text-only-example.html',
styleUrls: ['empty-state-text-only-example.css']
})
export class EmptyStateTextOnlyExample {
readonly styles = KbqButtonStyles;
readonly colors = KbqComponentColors;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.kbq-empty-state {
min-height: 216px;
}
Loading
Loading