-
Notifications
You must be signed in to change notification settings - Fork 471
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 guide on using different icon set (#157)
* feat(demo): add guide on using different icon set * Update icon-set.template.html Co-authored-by: Roman Sedov <darragon-nn@yandex.ru>
- Loading branch information
1 parent
eef8382
commit b35a891
Showing
19 changed files
with
347 additions
and
21 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
15 changes: 15 additions & 0 deletions
15
projects/demo/src/modules/customization/icon-set/examples/1/index.html
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,15 @@ | ||
<div class="b-form"> | ||
<tui-notification> | ||
As usual with the DI this is hierarchical. Meaning you can provide | ||
different <code>TUI_ICONS_PATH</code> and use different icons across | ||
your app. | ||
</tui-notification> | ||
<tui-input-date-range | ||
class="tui-space_top-4" | ||
tuiHintContent="You can use any icons you want" | ||
[tuiTextfieldCleaner]="true" | ||
[(ngModel)]="date" | ||
> | ||
Pick your favorite date range | ||
</tui-input-date-range> | ||
</div> |
117 changes: 117 additions & 0 deletions
117
projects/demo/src/modules/customization/icon-set/examples/1/index.less
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,117 @@ | ||
tui-wrapper[data-appearance='material-textfield'] { | ||
background: #f5f5f5; | ||
color: rgba(0, 0, 0, 0.87); | ||
border-radius: 4px 4px 0 0; | ||
|
||
&:after { | ||
height: 1px; | ||
background: #8e8e8e; | ||
top: auto; | ||
border: none; | ||
transform-origin: bottom; | ||
transition: all 0.3s; | ||
} | ||
|
||
&[data-state='hovered'] { | ||
background: #ececec; | ||
|
||
&:after { | ||
background: #1f1f1f; | ||
} | ||
} | ||
|
||
&._focused { | ||
background: #dcdcdc; | ||
|
||
// TODO: Better internal elements customization | ||
label { | ||
color: #6200ee !important; | ||
} | ||
|
||
&:after { | ||
background: #6200ee; | ||
transform: scaleY(2); | ||
} | ||
} | ||
} | ||
|
||
tui-wrapper[data-appearance='material-button'] { | ||
border-radius: 4px; | ||
background: #6200ee; | ||
color: #fff; | ||
text-transform: uppercase; | ||
font-weight: bold; | ||
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14%), | ||
0px 1px 5px 0px rgba(0, 0, 0, 0.12); | ||
transition: all 0.3s; | ||
|
||
&[data-state='hovered'] { | ||
background: #6e14ef; | ||
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), | ||
0px 1px 10px 0px rgba(0, 0, 0, 0.12); | ||
} | ||
|
||
&[data-state='pressed'] { | ||
background: #6e14ef; | ||
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), | ||
0px 3px 14px 2px rgba(0, 0, 0, 0.12); | ||
} | ||
|
||
&._focused { | ||
background: #883df2; | ||
|
||
&:after { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
tui-wrapper[data-appearance='material-checkbox-on'], | ||
tui-wrapper[data-appearance='material-checkbox-off'] { | ||
color: #fff; | ||
|
||
&:before { | ||
position: absolute; | ||
content: ''; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
border-radius: 2px; | ||
border: 2px solid rgba(0, 0, 0, 0.54); | ||
transition: all 0.3s; | ||
} | ||
|
||
&:after { | ||
position: absolute; | ||
top: -8px; | ||
left: -8px; | ||
right: -8px; | ||
bottom: -8px; | ||
border-radius: 100%; | ||
background: #000; | ||
opacity: 0; | ||
transition: opacity 0.3s; | ||
} | ||
|
||
&[data-state='hovered'] { | ||
&:after { | ||
opacity: 0.05; | ||
} | ||
} | ||
|
||
&[data-state='pressed'], | ||
&._focused { | ||
&:after { | ||
opacity: 0.1; | ||
} | ||
} | ||
} | ||
|
||
tui-wrapper[data-appearance='material-checkbox-on'] { | ||
&:before, | ||
&:after { | ||
background: #6200ee; | ||
border-color: transparent; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
projects/demo/src/modules/customization/icon-set/examples/1/index.ts
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,32 @@ | ||
import {Component} from '@angular/core'; | ||
import {TUI_ICONS_PATH} from '@taiga-ui/core'; | ||
|
||
const MAPPER: Record<string, string> = { | ||
tuiIconCalendarLarge: 'date_range-24px', | ||
tuiIconTooltipLarge: 'help-24px', | ||
tuiIconInfo: 'info-16px', | ||
tuiIconCloseLarge: 'clear-24px', | ||
tuiIconChevronLeftLarge: 'keyboard_arrow_left-24px', | ||
tuiIconChevronRightLarge: 'keyboard_arrow_right-24px', | ||
// and so on | ||
}; | ||
|
||
// This assumes that icons were properly processed | ||
export function iconsPath(name: string): string { | ||
return `assets/icons/${MAPPER[name]}.svg#${MAPPER[name]}`; | ||
} | ||
|
||
@Component({ | ||
selector: 'tui-icon-set-example-1', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
providers: [ | ||
{ | ||
provide: TUI_ICONS_PATH, | ||
useValue: iconsPath, | ||
}, | ||
], | ||
}) | ||
export class TuiIconSetExample1 { | ||
date = null; | ||
} |
30 changes: 30 additions & 0 deletions
30
projects/demo/src/modules/customization/icon-set/icon-set.component.ts
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,30 @@ | ||
import {default as example1Html} from '!!raw-loader!./examples/1/index.html'; | ||
import {default as example1Less} from '!!raw-loader!./examples/1/index.less'; | ||
import {default as example1Ts} from '!!raw-loader!./examples/1/index.ts'; | ||
|
||
import {Component} from '@angular/core'; | ||
import {tuiCoreIcons, tuiKitIcons} from '@taiga-ui/icons'; | ||
import {changeDetection} from '../../../change-detection-strategy'; | ||
import {FrontEndExample} from '../../interfaces/front-end-example'; | ||
|
||
@Component({ | ||
selector: 'icon-set', | ||
templateUrl: './icon-set.template.html', | ||
styleUrls: ['./icon-set.style.less'], | ||
changeDetection, | ||
}) | ||
export class IconSetComponent { | ||
readonly example1: FrontEndExample = { | ||
TypeScript: example1Ts, | ||
HTML: example1Html, | ||
LESS: example1Less, | ||
}; | ||
|
||
readonly names = [...Object.keys(tuiCoreIcons), ...Object.keys(tuiKitIcons)]; | ||
|
||
expanded = false; | ||
|
||
toggle() { | ||
this.expanded = !this.expanded; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
projects/demo/src/modules/customization/icon-set/icon-set.module.ts
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 @@ | ||
import {ClipboardModule} from '@angular/cdk/clipboard'; | ||
import {CommonModule} from '@angular/common'; | ||
import {NgModule} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {RouterModule} from '@angular/router'; | ||
import { | ||
generateRoutes, | ||
TUI_DOC_PAGE_MODULES, | ||
TuiDocCopyModule, | ||
} from '@taiga-ui/addon-doc'; | ||
import { | ||
TuiButtonModule, | ||
TuiExpandModule, | ||
TuiHintControllerModule, | ||
TuiLinkModule, | ||
TuiNotificationModule, | ||
TuiTextfieldControllerModule, | ||
} from '@taiga-ui/core'; | ||
import {TuiInputDateRangeModule} from '@taiga-ui/kit'; | ||
import {TuiIconSetExample1} from './examples/1'; | ||
import {IconSetComponent} from './icon-set.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
ClipboardModule, | ||
TuiDocCopyModule, | ||
TuiLinkModule, | ||
TuiExpandModule, | ||
TuiButtonModule, | ||
TuiInputDateRangeModule, | ||
TuiNotificationModule, | ||
TuiTextfieldControllerModule, | ||
TuiHintControllerModule, | ||
...TUI_DOC_PAGE_MODULES, | ||
RouterModule.forChild(generateRoutes(IconSetComponent)), | ||
], | ||
declarations: [IconSetComponent, TuiIconSetExample1], | ||
exports: [IconSetComponent], | ||
}) | ||
export class IconSetModule {} |
5 changes: 5 additions & 0 deletions
5
projects/demo/src/modules/customization/icon-set/icon-set.style.less
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,5 @@ | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} |
Oops, something went wrong.