From 0be66165e49974bb6ebbc270e17c36034f772e85 Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 7 Aug 2024 21:29:17 +0300 Subject: [PATCH] feat(addon-doc): improve ui for link to sample --- .../components/example/example.component.ts | 5 ++- .../components/example/example.style.less | 30 +++++++++++++---- .../components/example/example.template.html | 32 ++++++++++--------- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/projects/addon-doc/components/example/example.component.ts b/projects/addon-doc/components/example/example.component.ts index 5aa447951ff7..251355e91dc4 100644 --- a/projects/addon-doc/components/example/example.component.ts +++ b/projects/addon-doc/components/example/example.component.ts @@ -1,7 +1,7 @@ import {Clipboard} from '@angular/cdk/clipboard'; import {AsyncPipe, NgForOf, NgIf, NgTemplateOutlet} from '@angular/common'; import {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core'; -import {RouterLink} from '@angular/router'; +import {RouterLink, RouterLinkActive} from '@angular/router'; import {WA_LOCATION} from '@ng-web-apis/common'; import { TUI_DOC_CODE_ACTIONS, @@ -17,6 +17,7 @@ import {TUI_IS_E2E} from '@taiga-ui/cdk/tokens'; import type {TuiContext} from '@taiga-ui/cdk/types'; import {TuiAlertService} from '@taiga-ui/core/components/alert'; import {TuiButton} from '@taiga-ui/core/components/button'; +import {TuiLink} from '@taiga-ui/core/components/link'; import {TuiLoader} from '@taiga-ui/core/components/loader'; import {TuiTabs} from '@taiga-ui/kit/components/tabs'; import {TUI_COPY_TEXTS} from '@taiga-ui/kit/tokens'; @@ -50,6 +51,8 @@ import {TuiDocExampleGetTabsPipe} from './example-get-tabs.pipe'; TuiMapperPipe, NgTemplateOutlet, TuiDocCode, + TuiLink, + RouterLinkActive, ], templateUrl: './example.template.html', styleUrls: ['./example.style.less'], diff --git a/projects/addon-doc/components/example/example.style.less b/projects/addon-doc/components/example/example.style.less index 1ada99e96520..7a24f7fc9d5f 100644 --- a/projects/addon-doc/components/example/example.style.less +++ b/projects/addon-doc/components/example/example.style.less @@ -16,13 +16,36 @@ } } +.t-title-block { + display: flex; + flex-direction: row-reverse; +} + .t-title { font: var(--tui-font-heading-5); - margin: 0 0 0.5rem; + margin: 0 auto 0.5rem 0; @media @tui-mobile { font: var(--tui-font-heading-6); } + + &:hover + .t-link { + opacity: 1; + } +} + +.t-link { + font: var(--tui-font-heading-6); + padding-right: 0.1rem; + + @media not @tui-mobile { + font: var(--tui-font-heading-5); + margin-left: -1.6rem; + + &:not(:hover):not(.t-link-active) { + opacity: 0; + } + } } .t-description { @@ -89,11 +112,6 @@ } } -.t-link-icon { - margin-left: 0.3rem; - vertical-align: baseline; -} - .t-content { will-change: opacity; block-size: 0; diff --git a/projects/addon-doc/components/example/example.template.html b/projects/addon-doc/components/example/example.template.html index 130f828530b2..b548312ccaa7 100644 --- a/projects/addon-doc/components/example/example.template.html +++ b/projects/addon-doc/components/example/example.template.html @@ -1,26 +1,28 @@ -

- +

+