Skip to content

Commit

Permalink
feat: shorter label for narrow devices
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilR8 committed Jan 8, 2025
1 parent d29caff commit 96d55be
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
</template>
<template #get-access>
{% if not user.is_authenticated %}
<access-link
class="header__access-link"
base="{% url 'homepage' %}"
></access-link>
<access-link base="{% url 'homepage' %}"></access-link>
{% endif %}
</template>
</header-component>
Expand Down
18 changes: 14 additions & 4 deletions solution/ui/regulations/css/scss/partials/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ header {

&--first {
height: 56px;
gap: 1rem;
gap: 1.5rem;
}

&--second {
Expand Down Expand Up @@ -152,7 +152,17 @@ header {
}

.header__access-link {
margin-left: 0.5rem;
&--wide {
@include custom-max(calc((calc($eds-width-sm - 1px)) / 1px)) {
display: none;
}
}

&--narrow {
@include custom-min(calc($eds-width-sm / 1px)) {
display: none;
}
}

&.header--links__anchor {
@include header__anchor--complete;
Expand Down Expand Up @@ -543,10 +553,10 @@ header {
padding: 0;
}
}

}

.header--search:has(.search__form--expanded) + .header--sign-in {
.header--search:has(.search__form--expanded) ~ .header--sign-in,
.header--search:has(.search__form--expanded) ~ .header__access-link {
display: none;
}
}
Expand Down
16 changes: 13 additions & 3 deletions solution/ui/regulations/eregs-vite/src/components/AccessLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,23 @@ const props = defineProps({
const getAccessUrl = computed(() => `${props.base}get-account-access/`);
const isActive = window.location.pathname.includes("get-account-access");
const propsObj = {
name: "get-account-access",
active: isActive,
href: getAccessUrl.value,
};
</script>

<template>
<HeaderLink
name="get-account-access"
v-bind="propsObj"
class="header__access-link header__access-link--narrow"
label="Get Access"
/>
<HeaderLink
v-bind="propsObj"
class="header__access-link header__access-link--wide"
label="Get Account Access"
:active="isActive"
:href="getAccessUrl"
/>
</template>
6 changes: 1 addition & 5 deletions solution/ui/regulations/eregs-vite/src/views/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,7 @@ getDocsOnLoad();
/>
</template>
<template #get-access>
<AccessLink
v-if="!isAuthenticated"
class="header__access-link"
:base="homeUrl"
/>
<AccessLink v-if="!isAuthenticated" :base="homeUrl" />
</template>
</HeaderComponent>
</header>
Expand Down
6 changes: 1 addition & 5 deletions solution/ui/regulations/eregs-vite/src/views/Statutes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ getStatutesArray();
/>
</template>
<template #get-access>
<AccessLink
v-if="!isAuthenticated"
class="header__access-link"
:base="homeUrl"
/>
<AccessLink class="header__access-link" :base="homeUrl" />
</template>
</HeaderComponent>
</header>
Expand Down
6 changes: 1 addition & 5 deletions solution/ui/regulations/eregs-vite/src/views/Subjects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,7 @@ getDocSubjects();
/>
</template>
<template #get-access>
<AccessLink
v-if="!isAuthenticated"
class="header__access-link"
:base="homeUrl"
/>
<AccessLink class="header__access-link" :base="homeUrl" />
</template>
</HeaderComponent>
</header>
Expand Down

0 comments on commit 96d55be

Please sign in to comment.