Skip to content

Commit

Permalink
refactor(ember/top-nav): single file component
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Mar 27, 2024
1 parent 2dbab71 commit cb6489d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 51 deletions.
56 changes: 56 additions & 0 deletions ember/app/components/top-nav.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { concat } from '@ember/helper';
import { LinkTo } from '@ember/routing';
import UkTooltip from 'ember-uikit/modifiers/uk-tooltip';

import appVersion from 'outdated/utils/app-version';

<template>
<div
class='navbar'
uk-sticky='sel-target: .navbar-container; cls-active: uk-navbar-sticky'
>
<nav class='navbar-container' uk-navbar>
<div class='uk-navbar-left'>
<div class='uk-navbar-item uk-logo uk-visible@m'>
<LinkTo
{{UkTooltip (concat 'v' (appVersion))}}
@route='projects'
class='uk-link-reset'
>
Outdated
</LinkTo>
</div>

<ul class='button-nav uk-hidden@m'>
<li>
<LinkTo
@route='projects.index'
@current-when='projects.index projects.detailed not-found'
class='uk-hidden@m'
{{UkTooltip (concat 'v' (appVersion)) offset=false}}
>Outdated</LinkTo>
</li>
</ul>
</div>
<div class='uk-navbar-right'>
<ul class='button-nav'>
<li class='uk-visible@m'>
<LinkTo
@route='projects.index'
@current-when='projects.index projects.detailed not-found'
>Overview</LinkTo>
</li>
<li>
<LinkTo @route='projects.add'>Add</LinkTo>
</li>
<li>
<LinkTo @route='dependencies'>Dependencies</LinkTo>
</li>
<li>
<LinkTo @route='versions'>Versions</LinkTo>
</li>
</ul>
</div>
</nav>
</div>
</template>
51 changes: 0 additions & 51 deletions ember/app/components/top-nav/template.hbs

This file was deleted.

7 changes: 7 additions & 0 deletions ember/app/utils/app-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { versionRegExp } from 'ember-cli-app-version/utils/regexp';

import config from 'outdated/config/environment';

const appVersion = () => config.APP.version.match(versionRegExp);

export default appVersion;

0 comments on commit cb6489d

Please sign in to comment.