Parcourir la source

:art: forcing image crop | altering hero to 2.1:1 aspect ratio (between 21:9 and 16:9)

tags/0.9.0
J il y a 4 ans
Parent
révision
5afdad7465

+ 0
- 32
vue-theme/src/app.vue Voir le fichier

@@ -41,9 +41,6 @@ html
41 41
             /* :--headings, a */
42 42
             a
43 43
                 color: $cia_red
44
-                &:hover
45
-                    /* leave obvious for testing */
46
-                    color: green
47 44
 
48 45
             img
49 46
                 transition: $transition ease-in
@@ -52,40 +49,11 @@ html
52 49
                     cursor: pointer
53 50
 
54 51
             > [class^="page--"]
55
-                /* background-color: lightblue */
56 52
                 max-width: $max-width
57 53
                 margin: 0 auto
58 54
                 padding: $ms-0 0
59 55
                 align-items: flex-start
60
-                
61 56
                 /* Block Shadow Thing */
62 57
                 .shadow
63 58
                     box-shadow: rgba(0 0 0 / 15%) 0.3px 0.5px 1.5px 0.5px
64
-
65
-                /* Content Pieces excluding index*/
66
-                .post
67
-                    /* bg for list pages */
68
-                    background-color: white
69
-                    margin: 0 0 $ms-0
70
-                    &--title
71
-                        color: yellow
72
-                        padding: 0 0 $ms-0
73
-                    &--content
74
-                        color: orange
75
-                        &--block > p
76
-                            color: grey
77
-                        .wp-block-image
78
-                            margin: 0
79
-                            img
80
-                                width: 100%
81
-                    > ul
82
-                        list-style: none
83
-                
84
-                /* Single & List Pages*/
85
-                /* > article */
86
-                article
87
-                    /* background-color: lightpink */
88
-                
89
-        nav, footer
90
-            &.main /* background-color: pink */
91 59
 </style>

+ 12
- 5
vue-theme/src/components/card.vue Voir le fichier

@@ -16,7 +16,8 @@
16 16
             p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event').split(',')[1] }}
17 17
             p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event') }}
18 18
             p.excerpt {{ content.excerpt }}
19
-            router-link(:to="`/${type}/${content.slug}`") read more
19
+            router-link(:to="`/${type}/${content.slug}`")
20
+                p.read-more read more
20 21
 </template>
21 22
 
22 23
 <script>
@@ -46,6 +47,12 @@ export default {
46 47
         justify-content: center
47 48
         > a
48 49
             line-height: 0
50
+            /* Force crop images */
51
+            .featured-or-hero-image img
52
+                object-fit: cover
53
+                object-position: 0% 30%
54
+                max-height: 160px
55
+                overflow-y: clip
49 56
     header a
50 57
         font-size: $ms--2
51 58
         text-decoration: none
@@ -65,12 +72,12 @@ export default {
65 72
     p
66 73
         &.datetime
67 74
             font-size: $ms--1
68
-            margin: 0 0 calc($ms-0/2) 0
69
-            line-height: calc($ms-0/2)
75
+            margin: 0
70 76
         &.excerpt
71 77
             overflow: hidden
72
-            margin: 0 0 $ms--2 0
73
-
78
+            margin: 0
79
+        &.read-more
80
+            font-size: $ms--1
74 81
     
75 82
 /* for widths larger than 768px */
76 83
 @media (min-width: $medium)

+ 15
- 4
vue-theme/src/components/hero.vue Voir le fichier

@@ -55,14 +55,14 @@ export default {
55 55
     },
56 56
     methods: {
57 57
         onResize() {
58
-            this.heroHeight = this.$el.offsetWidth / 1.8
58
+            this.heroHeight = this.$el.offsetWidth / 2.1
59 59
         },
60 60
         getThumbnailFromYt(url) {
61 61
             return ytThumbnail(url, 'max')
62 62
         },
63 63
     },
64 64
     mounted() {
65
-        this.heroHeight = this.$el.offsetWidth / 1.8
65
+        this.heroHeight = this.$el.offsetWidth / 2.1
66 66
         this.$nextTick(() => {
67 67
             window.addEventListener('resize', this.onResize)
68 68
         })
@@ -105,10 +105,21 @@ export default {
105 105
         z-index: 0
106 106
 
107 107
     &--image
108
+        min-width: 360px
109
+        max-height: 50vh
110
+        img
111
+            position: relative
112
+            min-width: 100vw
113
+            height: auto
114
+            z-index: -1
115
+            top: -30%
108 116
         &--overlay
109
-            /* color: $cia_white */
110 117
             position: absolute
111
-            margin: 19% 0
118
+            height: 100%
119
+            width: 100vw
120
+            right: 0
121
+            left: 0
122
+            overflow: clip
112 123
             h2
113 124
                 /* need better responsive solution for heading size  */
114 125
                 font-size: 3vw

+ 5
- 0
vue-theme/src/pages/index.vue Voir le fichier

@@ -132,6 +132,11 @@ export default {
132 132
             li
133 133
                 margin: 0
134 134
                 min-height: 10em
135
+                /* Big boxes */
136
+                &:nth-of-type(1), &:nth-of-type(3)
137
+                    /* Force crop images */
138
+                    .featured-or-hero-image img
139
+                        max-height: 300px
135 140
                 /* n1 episode */
136 141
                 &:nth-of-type(1)
137 142
                     grid-column-start: 1

Chargement…
Annuler
Enregistrer