Skip to content

Commit

Permalink
Use router to navigate collective tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
utarwyn committed Jan 6, 2024
1 parent 00fcb7a commit ef666b4
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 133 deletions.
1 change: 1 addition & 0 deletions src/assets/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
--color-primary-lighter: hsl(220, 43%, 65%);
--color-primary-focus-ring: hsl(220, 43%, 37%, 20%);
--color-secondary: #57c18b;
--color-tertiary: #f05067;
--color-on-surface: #022826;
}
26 changes: 14 additions & 12 deletions src/components/global/Header.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<header :style="{ backgroundColor: pageColors[route.path] || defaultColor }">
<header :style="{ backgroundColor: pageColor }">
<router-link to="/">
<img class="logo-header" src="@/assets/img/logo.webp" width="167" height="25" alt="ecoCode logo" @click="closeMenu"/>
</router-link>
<ul :style="{ backgroundColor: pageColors[route.path] || defaultColor }" :class="{ 'menu-open': isMenuOpen }">
<ul :style="{ backgroundColor: pageColor }" :class="{ 'menu-open': isMenuOpen }">
<router-link to="/contributeur" @click="closeMenu">
<img width="40" height="40" v-if="isContributeurPage" src="@/assets/img/icon/arrow-left-white.webp">
<li :class="{ active: isContributeurPage }">Contributeur</li>
Expand Down Expand Up @@ -48,16 +48,18 @@ const closeMenu = () => {
const isContributeurPage = computed(() => route.path === '/contributeur');
const isEntreprisePage = computed(() => route.path === '/entreprise');
const isTeamPage = computed(() => route.path === '/collectif');
const isPage = computed(() => route.path === '/contributeur' || route.path === '/entreprise' || route.path === '/team');
const pageColors: Record<string, string> = {
'/contributeur': '#529a75ff',
'/entreprise': '#4f65a0ff',
'/collectif': '#95353eff',
};
const defaultColor = '#3a4e72ff';
const isTeamPage = computed(() => route.path.startsWith('/collectif'));
const pageColor = computed(() => {
if (isContributeurPage.value) {
return '#529a75';
} else if (isEntreprisePage.value) {
return '#4f65a0';
} else if (isTeamPage.value) {
return '#95353e';
}
return '#3a4e72';
});
</script>

<style lang="scss" scoped>
Expand Down
11 changes: 9 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import HomeView from '../views/Accueil/Home.vue'
import Documentation from '../views/Accueil/Doc.vue'
import ContributeurView from '../views/Page/contributeur/contributeur.vue'
import EntrepriseView from '../views/Page/entreprise/entreprise.vue'
import TeamView from '../views/Page/team/team.vue'
import TeamView from '@/views/Page/team/Team.vue'
import TeamMembers from '@/views/Page/team/TeamMembers.vue';
import TeamPartnerOrganizations from '@/views/Page/team/TeamPartnerOrganizations.vue';

const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
Expand All @@ -26,7 +28,12 @@ const router = createRouter({
{
path: '/collectif',
name: 'collectif',
component: TeamView
component: TeamView,
children: [
{ path: '', redirect: '/collectif/membres' },
{ path: 'membres', name: 'collectif-membres', component: TeamMembers },
{ path: 'organisations', name: 'collectif-organisations', component: TeamPartnerOrganizations },
]
},
{
path: '/Documentation',
Expand Down
4 changes: 2 additions & 2 deletions src/views/Accueil/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
subtitle="Quelques structures partenaires :">
<PartnerOrganizationList :featured="true" />
<div class="block-button-section-1">
<ButtonBlock typebutton="white" link="/collectif?tab=entreprise" text="Toutes les entreprises partenaires" />
<ButtonBlock typebutton="white" link="/collectif?tab=membre" text="Tous nos membres contributeurs" />
<ButtonBlock typebutton="white" link="/collectif/organisations" text="Toutes les entreprises partenaires" />
<ButtonBlock typebutton="white" link="/collectif/membres" text="Tous nos membres contributeurs" />
</div>
</TitleBox>
<ContactForm />
Expand Down
49 changes: 49 additions & 0 deletions src/views/Page/team/Team.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router';
</script>

<template>
<nav>
<router-link to="membres">Membres contributeurs</router-link>
<router-link to="organisations">Organisations partenaires</router-link>
</nav>
<router-view/>
</template>

<style lang="scss" scoped>
nav {
background-color: var(--color-tertiary);
display: flex;
justify-content: center;
flex-direction: column;
padding: 3.5rem 0;
gap: 2rem;
> a {
opacity: 0.5;
text-align: center;
color: white;
font-size: 1.5rem;
font-weight: 900;
&.router-link-active {
opacity: 1 !important;
text-decoration: underline;
text-underline-offset: 15px;
}
}
@media screen and (min-width: 796px) {
flex-direction: row;
gap: 4rem;
}
@media screen and (min-width: 960px) {
gap: 8rem;
> a {
font-size: 2rem;
}
}
}
</style>
16 changes: 16 additions & 0 deletions src/views/Page/team/TeamMembers.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import contributors from "@/assets/data/contributors.json";
import coreMembers from "@/assets/data/core-members.json";
import MemberList from "@/components/collective/MemberList.vue";
import AppSection from "@/components/Shared/AppSection.vue";
</script>

<template>
<AppSection title="Core team" sub-title="L'équipe qui pilote ecoCode">
<MemberList :members="coreMembers"/>

Check failure on line 10 in src/views/Page/team/TeamMembers.vue

View workflow job for this annotation

GitHub Actions / build

Type '({ name: string; company: string; profile: string; links: { linkedin: string; github: string; }; } | { name: string; profile: string; links: { linkedin: string; github: string; }; company?: undefined; })[]' is not assignable to type 'Member[]'.
</AppSection>

<AppSection title="Contributrices et contributeurs" background-color="grey">
<MemberList :members="contributors"/>
</AppSection>
</template>
16 changes: 16 additions & 0 deletions src/views/Page/team/TeamPartnerOrganizations.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import PartnerOrganizationList from '@/components/collective/PartnerOrganizationList.vue';
import AppSection from '@/components/Shared/AppSection.vue';
</script>

<template>
<AppSection title="De nombreuses organisations s'impliquent sur ecoCode">
<PartnerOrganizationList :featured="false"/>
</AppSection>
</template>

<style lang="scss" scoped>
.section {
margin-bottom: 50px;
}
</style>
51 changes: 0 additions & 51 deletions src/views/Page/team/scss/style.scss

This file was deleted.

66 changes: 0 additions & 66 deletions src/views/Page/team/team.vue

This file was deleted.

0 comments on commit ef666b4

Please sign in to comment.