|
1 | | -<h1 align="center">Component and documentation is still a WIP</h1> |
2 | | - |
3 | 1 | <div align="center"> |
4 | 2 | <img src="./.github/logo.png" width="200px"> |
5 | 3 | <h1>Vue Image Kit</h1> |
|
8 | 6 | Vue.js Image Kit Component with Lazy Load built in and Responsive Images |
9 | 7 | </p> |
10 | 8 | <p align="center"> |
11 | | - <a href="https://codesandbox.io/s/vue-lazy-load-image-ls9rh?fontsize=14&hidenavigation=1&module=%2Fsrc%2FApp.vue&theme=dark" target="_blank">Inspiration</a> and a talk from <a href="https://github.com/derevandal" target="_blank">@derevandal</a> |
| 9 | + The inspiration comes from <a href="https://codesandbox.io/s/vue-lazy-load-image-ls9rh?fontsize=14&hidenavigation=1&module=%2Fsrc%2FApp.vue&theme=dark" target="_blank">this</a> and a talk from <a href="https://github.com/derevandal" target="_blank">@derevandal</a> |
12 | 10 | </p> |
13 | 11 |
|
14 | 12 | <p align="center"> |
|
19 | 17 | <a href="http://standardjs.com"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg" alt="Style standard"></a> |
20 | 18 | </p> |
21 | 19 |
|
| 20 | +> **Note:** |
| 21 | +> This is an unofficial project. |
| 22 | +> I do not work or am I affiliated with Image Kit |
| 23 | +
|
22 | 24 | ## Demo |
23 | 25 |
|
24 | 26 | **TODO** |
25 | 27 |
|
| 28 | +## How does it work |
| 29 | + |
| 30 | +This component uses the [Image Kit](https://imagekit.io/) [Real-time URL-based image transformation](https://imagekit.io/features/image-resize-smart-crop-responsive-dpr-client-hints), so you will need to have your images over [Image Kit](https://imagekit.io/) for it to work |
| 31 | + |
| 32 | +For more informations about [Image Kit](https://imagekit.io/), consult their website |
| 33 | + |
26 | 34 | ## How to install |
27 | 35 |
|
28 | 36 | ### npm |
@@ -84,54 +92,34 @@ plugins: [ |
84 | 92 |
|
85 | 93 | ```html |
86 | 94 | <template> |
87 | | - <vue-image-kit :items="items"/> |
| 95 | + <div> |
| 96 | + <div style="height:4500px;width:100vw;background:gray"> </div> |
| 97 | + <vue-image-kit |
| 98 | + hash="6xhf1gnexgdgk" |
| 99 | + src="lion_BllLvaqVn.jpg" |
| 100 | + width="1400px" |
| 101 | + height="800px" |
| 102 | + alt="Lion image" |
| 103 | + /> |
| 104 | + </div> |
88 | 105 | </template> |
89 | | - |
90 | | -<script> |
91 | | -export default { |
92 | | - data() { |
93 | | - const example1 = { |
94 | | - title: 'Title example 1', |
95 | | - content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ex dolor, malesuada luctus scelerisque ac, auctor vitae risus. Vivamus risus dolor, faucibus a bibendum quis, facilisis eget odio.' |
96 | | - } |
97 | | - const example2 = { |
98 | | - title: 'Title example 2', |
99 | | - content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ex dolor, malesuada luctus scelerisque ac, auctor vitae risus. Vivamus risus dolor, faucibus a bibendum quis, facilisis eget odio.' |
100 | | - } |
101 | | - const example3 = { |
102 | | - title: 'Title example 3', |
103 | | - content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ex dolor, malesuada luctus scelerisque ac, auctor vitae risus. Vivamus risus dolor, faucibus a bibendum quis, facilisis eget odio.' |
104 | | - } |
105 | | - const items = [example1, example2, example3] |
106 | | -
|
107 | | - return { items } |
108 | | - } |
109 | | -} |
110 | | -</script> |
111 | 106 | ``` |
112 | 107 |
|
113 | 108 | ## Props |
114 | 109 |
|
115 | | -| Property name | Type | Default | Description | |
116 | | -|---------------------|--------:|:---------:|------------------------------------------------------------------------------------------------| |
117 | | -| items | Array | null | Array of objects to be displayed. Must have at least a content property | |
118 | | -| item-selected | Object | {} | Object that is set when it is clicked. Note that `clickable` prop must be set to true | |
119 | | -| item-unique-key | String | '' | Key to set a blue border to the card when it is clicked (`clickable` prop must be set to true) | |
120 | | -| title-attr | String | 'title' | Name of the property inside the objects, that are in the items array, to set the cards title | |
121 | | -| title-centered | Boolean | false | Centralizes the cards title | |
122 | | -| title-class | String | '' | If you want to set a custom class to the cards title, set it here | |
123 | | -| title-substr | String | 18 | Number of characters to display inside the cards title. Above this, will set a '...' mask | |
124 | | -| content-attr | String | 'content' | Name of the property inside the objects, that are in the items array, to set the cards content | |
125 | | -| content-centered | Boolean | false | Centralizes all the cards content text | |
126 | | -| content-class | String | '' | If you want to set a custom class to the cards content, set it here | |
127 | | -| content-substr | String | 250 | Number of characters to display inside the cards content. Above this, will set a '...' mask | |
128 | | -| has-slot | String | false | Set to true if you pass a `<slot>` to override `title` and `content` attributes | |
129 | | -| min-width | String | '200px' | Min-width of the timeline | |
130 | | -| min-height | String | '' | Min-height of the timeline | |
131 | | -| timeline-padding | String | '' | Padding of the timeline | |
132 | | -| timeline-background | String | '#E9E9E9' | Background color of the whole timeline | |
133 | | -| line-color | String | '#03A9F4' | Color of the line inside the timeline | |
134 | | -| clickable | Boolean | true | Makes the card clickable that returns the object | |
| 110 | +| Property name | Type | Default | Required | Description | |
| 111 | +|-----------------|--------|-----------------|----------|-------------------------------------------------------------------------------------| |
| 112 | +| hash | String | null | true | Images hash. Example: Take this image -> https://ik.imagekit.io/6xhf1gnexgdgk/lion_BllLvaqVn.jpg, the hash is '6xhf1gnexgdgk' | |
| 113 | +| src | String | null | true | Images source. Example: Take this image -> https://ik.imagekit.io/6xhf1gnexgdgk/lion_BllLvaqVn.jpg, the source is 'lion_BllLvaqVn.jpg' | |
| 114 | +| placeholder | String | '' | false | Images placeholder. Here you can pass a link | |
| 115 | +| backgroundColor | String | '' | false | Background color of the images placeholder | |
| 116 | +| srcset | Array | [320, 480, 800] | false | Array of numbers that will define the images srcset attribute. Each number correspond to one of the images width | |
| 117 | +| sizes | Array | [] | false | Array of numbers that will define the images sizes attribute. Each number correspond to one of the images max-width. Empty by default, which gets each of the images srcset prop and subtract by 40px | |
| 118 | +| defaultSize | Number | 1080 | true | Images default size. Must be larger than the largest srcset and sizes | |
| 119 | +| customTransform | String | '' | false | Use this to append any extra image kit transform that you want | |
| 120 | +| width | String | '' | false | Images width. Any valid CSS unit It will be set with inline style | |
| 121 | +| height | String | '' | false | Images height. Any valid CSS unit. It will be set with inline style | |
| 122 | +| alt | String | '' | false | Images alt attribute | |
135 | 123 |
|
136 | 124 | ## Development |
137 | 125 |
|
|
0 commit comments