Skip to content

Commit

Permalink
Simplify buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
utarwyn committed May 2, 2024
1 parent 588a9b9 commit 0cadb73
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 162 deletions.
11 changes: 11 additions & 0 deletions src/assets/variables.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
:root {
/* Colors */
--color-primary: #355086;
--color-on-primary: #ffffff;
--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;
--color-card-background: white;

/* Shadows */
--shadow-small: 0px 2px 2px rgba(0, 0, 0, .04);
--shadow-border: 0 0 0 1px rgba(0, 0, 0, .08);
--shadow-border-small: var(--shadow-border), var(--shadow-small);

--radius: 0.75rem;
}
3 changes: 2 additions & 1 deletion src/components/Shared/Selectfield.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defineProps<{ id: string; label: string; modelValue: string; items: string[] }>(
position: relative;
height: 56px;
background-color: white;
border-radius: 0.25rem;
border-radius: 0.5rem;
border: solid 1px #d8dae5;
transition: box-shadow .08s ease-in-out;
overflow: hidden;
Expand All @@ -64,6 +64,7 @@ defineProps<{ id: string; label: string; modelValue: string; items: string[] }>(
width: 24px;
height: 24px;
color: var(--color-primary);
pointer-events: none;
}
&:focus, &:focus-within {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Shared/Textfield.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ withDefaults(
height: 56px;
background-color: white;
padding: 1rem;
border-radius: 0.25rem;
border-radius: 0.5rem;
border: solid 1px #d8dae5;
font-size: 18px;
font-weight: 500;
Expand Down
4 changes: 2 additions & 2 deletions src/components/collective/PartnerOrganization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ defineProps<{ name: string; logo: { filename: string; width: number; height: num
align-items: center;
width: 180px;
height: 100px;
border: solid 1px #87ccff;
border-radius: 10px;
border-radius: var(--radius);
box-shadow: var(--shadow-border-small);
}
.name {
Expand Down
11 changes: 9 additions & 2 deletions src/components/company/CaseStudyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="error-message" v-if="error" aria-live="assertive">{{ error }}</div>
<div style="margin-top: 15px;" class="success-message" v-if="success" aria-live="assertive">{{ success }}</div>

<ButtonBlock type="submit" typebutton="blue" text="Recevez notre cas client"
<AppButton type="submit" variant="primary" text="Recevez notre cas client"
aria-label="Soumettez le formulaire"/>
</div>
</form>
Expand All @@ -31,7 +31,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import VueHcaptcha from '@hcaptcha/vue3-hcaptcha';
import ButtonBlock from '@/components/global/Button.vue';
import AppButton from '@/components/global/Button.vue';
import { post } from '@/util/fetch';
import Textfield from "@/components/Shared/Textfield.vue";
import Fieldset from "@/components/Shared/Fieldset.vue";
Expand Down Expand Up @@ -158,6 +158,13 @@ form {
flex-direction: column;
gap: 1rem;
.form-submit {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
@media (min-width: 796px) {
width: 768px;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/contributor/Newsletter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div style="margin-top: 15px;" class="error-message" v-if="error">{{ error }}</div>
<div style="margin-top: 15px;" class="success-message" v-if="success">{{ success }}</div>

<ButtonBlock type="submit" typebutton="blue" text="Recevoir les informations"/>
<AppButton type="submit" variant="primary" text="Recevoir les informations"/>

<div class="join-us">
<p>Tu souhaites contribuer sans plus attendre ? Rejoins-nous sur</p>
Expand All @@ -29,7 +29,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import VueHcaptcha from '@hcaptcha/vue3-hcaptcha';
import ButtonBlock from '@/components/global/Button.vue';
import AppButton from '@/components/global/Button.vue';
import { post } from '@/util/fetch';
import Textfield from "@/components/Shared/Textfield.vue";
Expand Down
7 changes: 3 additions & 4 deletions src/components/global/BoxInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ defineProps<{ title: string; text: string }>();
width: 257px;
height: 197px;
padding: 0 19px;
border-radius: 20px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
border: solid 2px rgba(135, 204, 255, 0);
border-radius: var(--radius);
box-shadow: var(--shadow-border-small);
display: flex;
flex-direction: row;
align-items: center;
Expand All @@ -53,7 +52,7 @@ defineProps<{ title: string; text: string }>();
line-height: normal;
letter-spacing: normal;
text-align: center;
background-color: white;
background-color: var(--color-card-background);
margin-top: 10px;
}
Expand Down
131 changes: 38 additions & 93 deletions src/components/global/Button.vue
Original file line number Diff line number Diff line change
@@ -1,109 +1,54 @@
<template>
<div class="container-button">
<span v-if="title">{{ title }}</span>
<span v-else class="empty"></span>
<button @click="navigateToRoute()" :class="buttonClass">
<ChevronLeft/>
{{ text }}
<ChevronRight/>
</button>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import ChevronLeft from '@/assets/icons/chevron_left.svg';
import ChevronRight from '@/assets/icons/chevron_right.svg';
import router from '@/router';
// Déclarez les props
const props = defineProps({
text: String,
title: String,
typebutton: String,
link: String,
});
const navigateToRoute = () => {
if (props.link) {
router.push(props.link);
}
};
const buttonClass = computed(() => {
if (props.typebutton === "blue") {
return "button blue";
} else {
return "button white";
}
});
import type { RouterLinkProps } from "vue-router";
withDefaults(defineProps<{
text: string;
variant: 'primary' | 'secondary';
type?: 'button' | 'submit'
link?: RouterLinkProps['to'];
}>(), { type: 'button' });
</script>

<template>
<router-link v-if="link" :class="variant" :to="link">
<ChevronLeft/>
{{ text }}
<ChevronRight/>
</router-link>
<button v-else :class="variant" :type="type">
<ChevronLeft/>
{{ text }}
<ChevronRight/>
</button>
</template>

<style lang="scss" scoped>
.container-button {
button,
a {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.empty {
padding: 30px 0 8px 0;
}
span {
font-size: 15px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: 2;
letter-spacing: normal;
text-align: center;
text-transform: uppercase;
color: #355086;
padding: 0 0 8px 0;
}
.button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 8.4px 13px 10px;
border-radius: 12px;
text-align: center;
font-size: 20px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: 0.24px;
margin: 0 82.5px 0 82.5px;
}
}
button:hover {
padding: 10px 1rem;
border-radius: var(--radius);
text-align: center;
font-size: 20px;
line-height: 24px;
font-weight: bold;
border: none;
cursor: pointer;
}
.blue {
background-color: #355086;
border: 2px solid white;
color: white;
}
.white {
background-color: white;
border: 2px solid #57c18b;
color: #355086;
}
@media screen and (max-width: 768px) {
.button {
margin: 0 19px 0 19px !important;
&.primary {
background-color: var(--color-primary);
color: var(--color-on-primary);
border: 2px solid var(--color-on-primary);
}
.container-button > .button {
font-size: 18px;
&.secondary {
background-color: white;
border: 2px solid var(--color-secondary);
color: var(--color-primary);
}
}
</style>
2 changes: 1 addition & 1 deletion src/components/global/ProcessRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ if (props.title === "utilisation" || props.image) {
height: 140px;
padding: 0 19px;
border-radius: 20px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
box-shadow: var(--shadow-border-small);
display: flex;
flex-direction: row;
align-items: center;
Expand Down
18 changes: 0 additions & 18 deletions src/components/global/Title.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,9 @@ const getSubtitleClass = computed(() => {
margin: 0 36px 0 36px;
padding-bottom: 20px;
}
.title-blue,
.title-white {
margin: 0 36px 0 36px;
font-size: 28px;
padding-top: 0px;
}
.subtitle-white,
.subtitle-black,
.subtitle-green,
.subtitle-black-light {
margin: 10px 36px 0 36px;
font-size: 20px;
padding: 0 0 0 0;
}
}
@media screen and (max-width: 768px) {
.title-blue,
.title-white {
margin: 0 36px 0 36px;
Expand All @@ -199,7 +182,6 @@ const getSubtitleClass = computed(() => {
.subtitle-black-light {
margin: 10px 36px 0 36px;
font-size: 15px;
padding: 0 0 0 0;
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/home/ContactForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="error-message" v-if="error" aria-live="assertive">{{ error }}</div>
<div style="margin-top: 15px;" class="success-message" v-if="success" aria-live="assertive">{{ success }}</div>

<ButtonBlock type="submit" typebutton="blue" text="Envoyer" aria-label="Envoyer le formulaire de contact"/>
<AppButton type="submit" variant="primary" text="Envoyer" aria-label="Envoyer le formulaire de contact"/>
</div>
</form>
</div>
Expand All @@ -45,7 +45,7 @@
import { ref, watch } from 'vue';
import VueHcaptcha from '@hcaptcha/vue3-hcaptcha';
import { post } from '@/util/fetch';
import ButtonBlock from "@/components/global/Button.vue";
import AppButton from "@/components/global/Button.vue";
import Textfield from "@/components/Shared/Textfield.vue";
import Fieldset from "@/components/Shared/Fieldset.vue";
import Selectfield from "@/components/Shared/Selectfield.vue";
Expand Down
22 changes: 8 additions & 14 deletions src/components/home/RuleProcess.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import ProcessRule from "@/components/global/ProcessRule.vue";
import ButtonBlock from "@/components/global/Button.vue";
import AppButton from "@/components/global/Button.vue";
</script>

<template>
Expand All @@ -24,8 +24,8 @@ import ButtonBlock from "@/components/global/Button.vue";
text="Une équipe expérimentée étudie et valide la nouvelle règle"/>
</div>
</div>
<span class="detail">Nous travaillons également sur des règles sur-mesure pour des organisations clientes</span>
<ButtonBlock typebutton="blue" link="/Entreprise" text="En savoir plus"/>
<p class="detail">Nous travaillons également sur des règles sur-mesure pour des organisations clientes.</p>
<AppButton variant="primary" link="/entreprise" text="En savoir plus"/>
</div>
</template>

Expand Down Expand Up @@ -71,16 +71,11 @@ import ButtonBlock from "@/components/global/Button.vue";
}
.detail {
max-width: 463px;
max-width: 720px;
font-size: 22px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: normal;
color: #022826;
text-align: center;
padding: 50px 0 50px 0;
padding: 50px 1rem;
}
@media screen and (max-width: 1150px) {
Expand Down Expand Up @@ -113,9 +108,8 @@ import ButtonBlock from "@/components/global/Button.vue";
}
@media screen and (max-width: 768px) {
.detail{
font-size: 20px;
padding-bottom: 0;
}
.detail {
font-size: 20px;
}
}
</style>
Loading

0 comments on commit 0cadb73

Please sign in to comment.