follow @mattwr18 PR review

- replace magic numbers with tokens
- remove unused name attribute
- use slot shorthand (for the slots added in this PR)
This commit is contained in:
Alina Beck 2020-02-17 10:44:52 +01:00
parent f1efdbad7d
commit ad385490bc
15 changed files with 58 additions and 40 deletions

View File

@ -211,7 +211,8 @@ $letter-spacing-x-small: -0.015em;
* @presenter Opacity * @presenter Opacity
*/ */
$opacity-soft: 0.65; $opacity-base: 1;
$opacity-soft: 0.7;
$opacity-disabled: 0.5; $opacity-disabled: 0.5;
/** /**
@ -264,12 +265,23 @@ $size-avatar-large: 114px;
$size-button-base: 36px; $size-button-base: 36px;
$size-button-small: 26px; $size-button-small: 26px;
/**
* @tokens Size Images
* @presenter Spacing
*/
$size-image-max-height: 2000px;
$size-image-cropper-max-height: 600px;
$size-image-cropper-min-height: 400px;
$size-image-uploader-min-height: 200px;
/** /**
* @tokens Size Icons * @tokens Size Icons
* @presenter Spacing * @presenter Spacing
*/ */
$size-icon-base: 16px; $size-icon-base: 16px;
$size-icon-large: 60px;
/** /**
* @tokens Shadow * @tokens Shadow
@ -285,6 +297,12 @@ $box-shadow-active: 0 0 6px 1px rgba(20, 100, 160, 0.5);
$box-shadow-inset: inset 0 0 20px 1px rgba(0,0,0,.15); $box-shadow-inset: inset 0 0 20px 1px rgba(0,0,0,.15);
$box-shadow-small-inset: inset 0 0 0 1px rgba(0,0,0,.05); $box-shadow-small-inset: inset 0 0 0 1px rgba(0,0,0,.05);
/**
* @tokens Effects
*/
$blur-radius: 22px;
/** /**
* @tokens Animation Duration * @tokens Animation Duration
*/ */
@ -317,6 +335,7 @@ $z-index-page-header: 2000;
$z-index-page-sidebar: 1500; $z-index-page-sidebar: 1500;
$z-index-sticky: 100; $z-index-sticky: 100;
$z-index-post-teaser-link: 5; $z-index-post-teaser-link: 5;
$z-index-surface: 1;
/** /**
* @tokens Media Query * @tokens Media Query

View File

@ -8,7 +8,7 @@
<base-card v-else :class="commentClass" :id="anchor"> <base-card v-else :class="commentClass" :id="anchor">
<header class="header"> <header class="header">
<user-teaser :user="comment.author" :date-time="comment.createdAt"> <user-teaser :user="comment.author" :date-time="comment.createdAt">
<template v-if="wasEdited" v-slot:dateTime> <template v-if="wasEdited" #dateTime>
<span>({{ $t('comment.edited') }})</span> <span>({{ $t('comment.edited') }})</span>
</template> </template>
</user-teaser> </user-teaser>

View File

@ -8,7 +8,7 @@
> >
<template slot-scope="{ errors }"> <template slot-scope="{ errors }">
<base-card> <base-card>
<template v-slot:heroImage> <template #heroImage>
<img <img
v-if="showHeroImage" v-if="showHeroImage"
:src="contribution.image | proxyApiUrl" :src="contribution.image | proxyApiUrl"
@ -276,7 +276,7 @@ export default {
} }
.image.--blur-image { .image.--blur-image {
filter: blur(22px); filter: blur($blur-radius);
} }
> .ds-form-item { > .ds-form-item {

View File

@ -89,7 +89,7 @@ export default {
} }
&.hint { &.hint {
opacity: 0.7; opacity: $opacity-soft;
pointer-events: none; pointer-events: none;
} }
} }

View File

@ -2,7 +2,6 @@
<base-card class="filter-menu"> <base-card class="filter-menu">
<h2>{{ $t('filter-menu.hashtag-search', { hashtag }) }}</h2> <h2>{{ $t('filter-menu.hashtag-search', { hashtag }) }}</h2>
<base-button <base-button
name="clear-search-button"
icon="close" icon="close"
circle circle
:title="this.$t('filter-menu.clearSearch')" :title="this.$t('filter-menu.clearSearch')"

View File

@ -5,7 +5,7 @@
<b>- {{ $t('quotes.african.author') }}</b> <b>- {{ $t('quotes.african.author') }}</b>
</blockquote> </blockquote>
<base-card> <base-card>
<template v-slot:imageColumn> <template #imageColumn>
<a :href="$t('login.moreInfoURL')" :title="$t('login.moreInfo')" target="_blank"> <a :href="$t('login.moreInfoURL')" :title="$t('login.moreInfo')" target="_blank">
<img class="image" alt="Human Connection" src="/img/sign-up/humanconnection.svg" /> <img class="image" alt="Human Connection" src="/img/sign-up/humanconnection.svg" />
</a> </a>
@ -40,7 +40,7 @@
<nuxt-link to="/registration/signup">{{ $t('login.register') }}</nuxt-link> <nuxt-link to="/registration/signup">{{ $t('login.register') }}</nuxt-link>
</p> </p>
</form> </form>
<template v-slot:topMenu> <template #topMenu>
<locale-switch offset="5" /> <locale-switch offset="5" />
</template> </template>
</base-card> </base-card>

View File

@ -64,7 +64,7 @@ export default {
} }
&.--read { &.--read {
opacity: 0.5; opacity: $opacity-disabled;
} }
> .description { > .description {

View File

@ -11,7 +11,7 @@
}" }"
:highlight="isPinned" :highlight="isPinned"
> >
<template v-if="post.image" v-slot:heroImage> <template v-if="post.image" #heroImage>
<img :src="post.image | proxyApiUrl" class="image" /> <img :src="post.image | proxyApiUrl" class="image" />
</template> </template>
<client-only> <client-only>
@ -158,7 +158,7 @@ export default {
height: 100%; height: 100%;
&.--blur-image > .hero-image > .image { &.--blur-image > .hero-image > .image {
filter: blur(22px); filter: blur($blur-radius);
} }
> .content { > .content {
@ -178,7 +178,7 @@ export default {
> .counter-icon { > .counter-icon {
display: block; display: block;
margin-right: $space-small; margin-right: $space-small;
opacity: 0.5; opacity: $opacity-disabled;
} }
> .content-menu { > .content-menu {

View File

@ -105,7 +105,7 @@ export default {
<style lang="scss"> <style lang="scss">
.image-uploader { .image-uploader {
position: relative; position: relative;
min-height: 200px; min-height: $size-image-uploader-min-height;
cursor: pointer; cursor: pointer;
.image + & { .image + & {
@ -125,20 +125,20 @@ export default {
} }
&.--blur-image .preview-image { &.--blur-image .preview-image {
filter: blur(22px); filter: blur($blur-radius);
} }
.preview-image { .preview-image {
width: 100%; width: 100%;
max-height: 2000px; max-height: $size-image-max-height;
object-fit: contain; object-fit: contain;
} }
> .crop-overlay { > .crop-overlay {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 400px; min-height: $size-image-cropper-min-height;
max-height: 600px; max-height: $size-image-cropper-max-height;
font-size: $font-size-base; font-size: $font-size-base;
> .img { > .img {
@ -148,16 +148,16 @@ export default {
> .crop-confirm { > .crop-confirm {
position: absolute; position: absolute;
left: 10px; left: $space-x-small;
top: 10px; top: $space-x-small;
z-index: 1; z-index: $z-index-surface;
} }
> .crop-cancel { > .crop-cancel {
position: absolute; position: absolute;
right: 10px; right: $space-x-small;
top: 10px; top: $space-x-small;
z-index: 1; z-index: $z-index-surface;
} }
} }
@ -168,11 +168,11 @@ export default {
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 1; z-index: $z-index-surface;
&:hover { &:hover {
> .base-icon { > .base-icon {
opacity: 1; opacity: $opacity-base;
} }
} }
@ -182,8 +182,8 @@ export default {
border-radius: 100%; border-radius: 100%;
border: $border-size-base dashed $color-neutral-20; border: $border-size-base dashed $color-neutral-20;
background-color: $color-neutral-95; background-color: $color-neutral-95;
font-size: 60px; font-size: $size-icon-large;
opacity: 0.7; opacity: $opacity-soft;
} }
} }
} }

View File

@ -80,7 +80,7 @@ storiesOf('UserTeaser', module)
}), }),
template: ` template: `
<user-teaser :user="user" :date-time="new Date()"> <user-teaser :user="user" :date-time="new Date()">
<template v-slot:dateTime> <template #dateTime>
- HEY! I'm edited - HEY! I'm edited
</template> </template>
</user> </user>

View File

@ -19,7 +19,7 @@ storiesOf('Generic/BaseCard', module)
components: { BaseCard }, components: { BaseCard },
template: ` template: `
<base-card style="width: 400px;"> <base-card style="width: 400px;">
<template v-slot:heroImage> <template #heroImage>
<img class="image" src="https://unsplash.com/photos/R4y_E5ZQDPg/download" /> <img class="image" src="https://unsplash.com/photos/R4y_E5ZQDPg/download" />
</template> </template>
<h2 class="title">I am a card heading</h2> <h2 class="title">I am a card heading</h2>
@ -32,7 +32,7 @@ storiesOf('Generic/BaseCard', module)
components: { BaseCard }, components: { BaseCard },
template: ` template: `
<base-card style="width: 600px;"> <base-card style="width: 600px;">
<template v-slot:imageColumn> <template #imageColumn>
<img class="image" src="/img/sign-up/humanconnection.svg" /> <img class="image" src="/img/sign-up/humanconnection.svg" />
</template> </template>
<h2 class="title">I am a card heading</h2> <h2 class="title">I am a card heading</h2>
@ -45,12 +45,12 @@ storiesOf('Generic/BaseCard', module)
components: { BaseCard }, components: { BaseCard },
template: ` template: `
<base-card style="width: 600px;"> <base-card style="width: 600px;">
<template v-slot:imageColumn> <template #imageColumn>
<img class="image" src="/img/sign-up/humanconnection.svg" /> <img class="image" src="/img/sign-up/humanconnection.svg" />
</template> </template>
<h2 class="title">I am a card heading</h2> <h2 class="title">I am a card heading</h2>
<p>And I am a paragraph.</p> <p>And I am a paragraph.</p>
<template v-slot:topMenu> <template #topMenu>
<base-button size="small">Menu</base-button> <base-button size="small">Menu</base-button>
</template> </template>
</base-card> </base-card>

View File

@ -84,7 +84,7 @@ export default {
> .hero-image { > .hero-image {
width: calc(100% + (2 * #{$space-base})); width: calc(100% + (2 * #{$space-base}));
max-height: 2000px; max-height: $size-image-max-height;
margin: -$space-base; margin: -$space-base;
margin-bottom: $space-base; margin-bottom: $space-base;
overflow: hidden; overflow: hidden;

View File

@ -1,11 +1,11 @@
<template> <template>
<ds-container width="small" class="password-reset"> <ds-container width="small" class="password-reset">
<base-card> <base-card>
<template v-slot:imageColumn> <template #imageColumn>
<img alt="Human Connection" src="/icon.png" class="image" /> <img alt="Human Connection" src="/icon.png" class="image" />
</template> </template>
<nuxt-child /> <nuxt-child />
<template v-slot:topMenu> <template #topMenu>
<locale-switch offset="5" /> <locale-switch offset="5" />
</template> </template>
</base-card> </base-card>

View File

@ -9,7 +9,7 @@
'--blur-image': blurred, '--blur-image': blurred,
}" }"
> >
<template v-slot:heroImage> <template #heroImage>
<img :src="post.image | proxyApiUrl" class="image" /> <img :src="post.image | proxyApiUrl" class="image" />
<aside v-show="post.imageBlurred" class="blur-toggle"> <aside v-show="post.imageBlurred" class="blur-toggle">
<img v-show="blurred" :src="post.image | proxyApiUrl" class="preview" /> <img v-show="blurred" :src="post.image | proxyApiUrl" class="preview" />
@ -23,7 +23,7 @@
</template> </template>
<section class="menu"> <section class="menu">
<user-teaser :user="post.author" :date-time="post.createdAt"> <user-teaser :user="post.author" :date-time="post.createdAt">
<template v-slot:dateTime> <template #dateTime>
<ds-text v-if="post.createdAt !== post.updatedAt">({{ $t('post.edited') }})</ds-text> <ds-text v-if="post.createdAt !== post.updatedAt">({{ $t('post.edited') }})</ds-text>
</template> </template>
</user-teaser> </user-teaser>
@ -249,7 +249,7 @@ export default {
} }
&.--blur-image > .hero-image > .image { &.--blur-image > .hero-image > .image {
filter: blur(22px); filter: blur($blur-radius);
} }
.blur-toggle { .blur-toggle {

View File

@ -1,11 +1,11 @@
<template> <template>
<ds-container width="medium"> <ds-container width="medium">
<base-card> <base-card>
<template v-slot:imageColumn> <template #imageColumn>
<img alt="Human Connection" src="/img/sign-up/nicetomeetyou.svg" /> <img alt="Human Connection" src="/img/sign-up/nicetomeetyou.svg" />
</template> </template>
<nuxt-child /> <nuxt-child />
<template v-slot:topMenu> <template #topMenu>
<locale-switch offset="5" /> <locale-switch offset="5" />
</template> </template>
</base-card> </base-card>