Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterOutlet, UrlSegment } from '@angular/router';
import { KbqDividerModule } from '@koobiq/components/divider';
import { KbqIcon } from '@koobiq/components/icon';
import { KbqLinkModule } from '@koobiq/components/link';
import { KbqModalService } from '@koobiq/components/modal';
import { KbqSidepanelService } from '@koobiq/components/sidepanel';
Expand All @@ -28,19 +29,28 @@ import {
DocsStructureItemTab
} from 'src/app/structure';
import { DocsDocStates } from '../../services/doc-states';
import { docsDevVersionPlaceholder, docsKoobiqVersion } from '../../version';
import { DocsAnchorsComponent } from '../anchors/anchors.component';
import { DocsExampleViewerComponent } from '../example-viewer/example-viewer';
import { DocsLiveExampleComponent } from '../live-example/docs-live-example';
import { DocsRegisterHeaderDirective } from '../register-header/register-header.directive';

// In local dev builds `docsKoobiqVersion` is the dev placeholder (no such git ref exists), so fall back to `main`.
const GITHUB_REPO_REF = docsKoobiqVersion === docsDevVersionPlaceholder ? 'main' : docsKoobiqVersion;

/** Base URL of the repository ref (release tag, or `main` in dev) used to link a doc item to its source directory. */
const GITHUB_REPO_TREE_URL = `https://github.com/koobiq/angular-components/tree/${GITHUB_REPO_REF}`;

@Component({
selector: 'docs-component-viewer',
imports: [
KbqTabsModule,
KbqLinkModule,
RouterOutlet,
RouterLink,
RouterLinkActive,
DocsRegisterHeaderDirective
DocsRegisterHeaderDirective,
KbqIcon
],
templateUrl: './component-viewer.template.html',
styleUrls: ['./component-viewer.scss'],
Expand Down Expand Up @@ -93,6 +103,11 @@ export class DocsComponentViewerComponent extends DocsLocaleState {

this.docStates.registerHeaderScrollContainer(this.elementRef.nativeElement);
}

/** Link to the item's source directory on GitHub, or `null` when the item has no known path. */
protected get githubSourceUrl(): string | null {
return this.structureItem.path ? `${GITHUB_REPO_TREE_URL}/${this.structureItem.path}` : null;
}
}

@Directive()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ structureItem.name[locale()!] }}
</div>
@if (!structureItem.isGuide) {
<div class="docs-component-navbar layout-row layout-padding-top-s">
<div class="docs-component-navbar layout-row layout-align-space-between-center layout-padding-top-s">
<nav kbqTabNavBar [tabNavPanel]="tabNavPanel">
<a kbqTabLink routerLinkActive="kbq-selected" [routerLink]="structureItemTab.Overview">
{{ t('overviewTab') }}
Expand All @@ -17,6 +17,19 @@
</a>
}
</nav>

@if (githubSourceUrl) {
Comment thread
artembelik marked this conversation as resolved.
<a
kbq-link
target="_blank"
rel="noopener noreferrer"
class="layout-margin-left-xl"
[href]="githubSourceUrl"
>
<i kbq-icon="kbq-code_16"></i>
{{ t('viewSourceOnGitHub') }}
</a>
Comment thread
Copilot marked this conversation as resolved.
}
</div>
}
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/app/services/i18n.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('DOCS_TRANSLATIONS', () => {
improvementSuggestions: { ru: 'Предложения по улучшению', en: 'Suggestions for improvement' },
overviewTab: { ru: 'Обзор', en: 'Overview' },
examplesTab: { ru: 'Примеры', en: 'Examples' },
viewSourceOnGitHub: { ru: 'Исходный код', en: 'Source code' },

welcomeTitle: { ru: 'Дизайн-система Koobiq', en: 'Koobiq design system' },
welcomeDescription: {
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/app/services/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const DOCS_TRANSLATIONS = {
improvementSuggestions: { ru: 'Предложения по улучшению', en: 'Suggestions for improvement' },
overviewTab: { ru: 'Обзор', en: 'Overview' },
examplesTab: { ru: 'Примеры', en: 'Examples' },
viewSourceOnGitHub: { ru: 'Исходный код', en: 'Source code' },

Comment thread
artembelik marked this conversation as resolved.
// welcome page
welcomeTitle: { ru: 'Дизайн-система Koobiq', en: 'Koobiq design system' },
Expand Down
Loading