Skip to content

Commit

Permalink
Merge pull request #46 from betagouv/add-navbar
Browse files Browse the repository at this point in the history
Ajout d'une barre de navigation
  • Loading branch information
Forster-Groux committed Jan 11, 2021
2 parents ae88a5f + 67c8874 commit 1282f81
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 62 deletions.
35 changes: 29 additions & 6 deletions front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.15.1",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
Expand Down
23 changes: 3 additions & 20 deletions front-end/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
<template>
<div id="nav">
<h1>Ma Cantine Egalim</h1>
<Welcome msg="Tout savoir sur la loi Egalim"/>
<TheNavbar/>

<router-link to="/about">About</router-link>
</div>
<router-view/>
</template>

<script>
// @ is an alias to /src
import Welcome from '@/components/Welcome.vue'
import TheNavbar from '@/components/TheNavbar.vue'
export default {
components: {
Welcome
TheNavbar
}
}
</script>
Expand All @@ -27,17 +23,4 @@ export default {
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
Binary file added front-end/src/assets/Marianne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed front-end/src/assets/logo.png
Binary file not shown.
86 changes: 86 additions & 0 deletions front-end/src/components/TheNavbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<template>
<div id="navbar">
<router-link :to="{ name: 'LandingPage' }" id="landing">
<img src="@/assets/Marianne.png" id="Marianne">
<div id="logo">
<div id="ma-cantine-beta-gouv"><span id="ma-cantine">ma-cantine</span>.beta.gouv.fr</div>
<div id="egalim">Pour une alimentatation saine, de qualité et plus durable dans nos assiettes grâce à EGAlim</div>
</div>
</router-link>
<router-link :to="{ name: 'KeypointsPage' }" class="navbar-item">Mesures phares</router-link>
<a class="navbar-item" href="https://beta.gouv.fr/startups/egalim.html" target="_blank">
À propos <i class="fas fa-external-link-alt"></i>
</a>
</div>
</template>

<script>
export default {
name: 'TheNavbar',
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
a {
text-decoration: none;
}
#navbar {
display: flex;
justify-content: space-between;
padding: 10px 50px;
}
#landing {
display: flex;
}
#Marianne {
height: 75px;
}
#logo {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 30px;
text-align: left;
width: 300px;
text-decoration: none;
}
#ma-cantine-beta-gouv {
font-style: italic;
font-weight: 200;
font-size: 25px;
line-height: 29px;
color: rgba(64, 64, 64, 0.85);
}
#ma-cantine {
font-weight: bold;
color: #F7B48E;
}
#egalim {
font-size: 11px;
font-weight: 600;
line-height: 15px;
color: rgba(0,0,0,0.83);
}
.navbar-item {
margin: auto 0;
border-radius: 25px;
padding: 15px;
font-size: 17px;
line-height: 20px;
color: rgba(64, 64, 64, 0.85);
}
.navbar-item:hover {
color: white;
background-color: #F7B48E;
}
</style>
21 changes: 0 additions & 21 deletions front-end/src/components/Welcome.vue

This file was deleted.

2 changes: 2 additions & 0 deletions front-end/src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import '@fortawesome/fontawesome-free/css/all.css'
import '@fortawesome/fontawesome-free/js/all.js'

createApp(App).use(router).mount('#app')
24 changes: 14 additions & 10 deletions front-end/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router';
import LandingPage from '@/views/LandingPage.vue';
import KeypointsPage from '@/views/KeypointsPage.vue';

const routes = [
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
path: '/',
name: 'LandingPage',
component: LandingPage,
},
{
path: '/mesures-phares',
name: 'KeypointsPage',
component: KeypointsPage,
}
]
];

const router = createRouter({
history: createWebHistory(),
routes
})
});

export default router
export default router;
5 changes: 0 additions & 5 deletions front-end/src/views/About.vue

This file was deleted.

5 changes: 5 additions & 0 deletions front-end/src/views/KeypointsPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<h1>Mesures Phares</h1>
</div>
</template>
5 changes: 5 additions & 0 deletions front-end/src/views/LandingPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<h1>Welcome</h1>
</div>
</template>

0 comments on commit 1282f81

Please sign in to comment.