|
@@ -1,19 +1,29 @@
|
|
-import { css } from "@linaria/core";
|
|
|
|
|
|
+import { css, cx } from "@linaria/core";
|
|
import { Image } from "@queenjs/ui";
|
|
import { Image } from "@queenjs/ui";
|
|
import { defineComponent } from "vue";
|
|
import { defineComponent } from "vue";
|
|
-import { number, string } from "vue-types";
|
|
|
|
|
|
+import { bool, number, string } from "vue-types";
|
|
|
|
|
|
const ThumbnailImage = defineComponent({
|
|
const ThumbnailImage = defineComponent({
|
|
props: {
|
|
props: {
|
|
src: string().isRequired,
|
|
src: string().isRequired,
|
|
size: number(),
|
|
size: number(),
|
|
|
|
+ objectContain: bool().def(false),
|
|
},
|
|
},
|
|
emits: ["click"],
|
|
emits: ["click"],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
return () => {
|
|
return () => {
|
|
|
|
+ const { objectContain } = props;
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div class={cardStyles} onClick={() => emit("click")}>
|
|
<div class={cardStyles} onClick={() => emit("click")}>
|
|
- <Image class="w-full h-full !object-contain" {...props} />
|
|
|
|
|
|
+ <Image
|
|
|
|
+ class={cx(
|
|
|
|
+ objectContain
|
|
|
|
+ ? "max-w-full max-h-full !object-contain"
|
|
|
|
+ : "w-full h-full"
|
|
|
|
+ )}
|
|
|
|
+ {...props}
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
@@ -23,9 +33,13 @@ const ThumbnailImage = defineComponent({
|
|
export default ThumbnailImage;
|
|
export default ThumbnailImage;
|
|
|
|
|
|
const cardStyles = css`
|
|
const cardStyles = css`
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
border-radius: 2px;
|
|
border-radius: 2px;
|
|
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkAgMAAAADIrmmAAAADFBMVEU7OzsAAABAQEA8PDx2WAOfAAAABHRSTlMZAAQKGjtSlQAAAX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t1JJBIph2TXqFF3EolEaiVt2lwSiUTqJtk1CjSXRCKR0kjuGjXqTiKRSDkku0aNupNIW0v3YdIpTDqHSS9h0m+UdJ5/j+fbnwfuGT4AAAAASUVORK5CYII=");
|
|
- background-size: contain;
|
|
|
|
|
|
+ /* background-size: cover; */
|
|
background-color: rgba(255, 255, 255, 0.8);
|
|
background-color: rgba(255, 255, 255, 0.8);
|
|
|
|
+ /* background-color: rgb(74, 74, 74); */
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
`;
|
|
`;
|