Blame view

prestige-vue-4.0.0/src/views/samples/uikit/MediaDemo.vue 5.21 KB
5b5ab7e5   함상기   20240409
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  <template>
      <div class="grid p-fluid">
          <div class="col-12">
              <div class="card">
                  <h5>Carousel</h5>
                  <Carousel :value="products" :numVisible="3" :numScroll="3" :circular="false" :responsiveOptions="carouselResponsiveOptions">
                      <template #item="product">
                          <div class="product-item">
                              <div class="product-item-content">
                                  <div class="mb-3">
                                      <img :src="'/demo/images/product/' + product.data.image" :alt="product.data.name" class="product-image" />
                                  </div>
                                  <div>
                                      <h4 class="mb-1">
                                          {{ product.data.name }}
                                      </h4>
                                      <h6 class="mt-0 mb-3">${{ product.data.price }}</h6>
                                      <span :class="'product-badge status-' + product.data.inventoryStatus.toLowerCase()">{{ product.data.inventoryStatus }}</span>
                                      <div class="car-buttons mt-5">
                                          <Button type="button" class="p-button p-button-rounded mr-2" icon="pi pi-search"></Button>
                                          <Button type="button" class="p-button-success p-button-rounded mr-2" icon="pi pi-star-fill"></Button>
                                          <Button type="button" class="p-button-help p-button-rounded" icon="pi pi-cog"></Button>
                                      </div>
                                  </div>
                              </div>
                          </div>
                      </template>
                  </Carousel>
              </div>
          </div>
  
          <div class="col-12">
              <div class="card">
                  <h5>Galleria</h5>
                  <Galleria :value="images" :responsiveOptions="galleriaResponsiveOptions" :numVisible="7" :circular="true" containerStyle="max-width: 800px; margin: auto">
                      <template #item="slotProps">
                          <img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
                      </template>
                      <template #thumbnail="slotProps">
                          <img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" tyle="width: 100%; display: block;" />
                      </template>
                  </Galleria>
              </div>
          </div>
  
          <div class="col-12">
              <div class="card">
                  <h5>Image</h5>
                  <div class="flex justify-content-center">
                      <Image src="/demo/images/galleria/galleria11.jpg" alt="Image" width="250" preview />
                  </div>
              </div>
          </div>
      </div>
  </template>
  
  <script>
  import ProductService from '@/service/ProductService';
  import PhotoService from '@/service/PhotoService';
  export default {
      data() {
          return {
              products: [],
              images: [],
              galleriaResponsiveOptions: [
                  {
                      breakpoint: '1024px',
                      numVisible: 5,
                  },
                  {
                      breakpoint: '960px',
                      numVisible: 4,
                  },
                  {
                      breakpoint: '768px',
                      numVisible: 3,
                  },
                  {
                      breakpoint: '560px',
                      numVisible: 1,
                  },
              ],
              carouselResponsiveOptions: [
                  {
                      breakpoint: '1024px',
                      numVisible: 3,
                      numScroll: 3,
                  },
                  {
                      breakpoint: '768px',
                      numVisible: 2,
                      numScroll: 2,
                  },
                  {
                      breakpoint: '560px',
                      numVisible: 1,
                      numScroll: 1,
                  },
              ],
          };
      },
      created() {
          this.productService = new ProductService();
          this.photoService = new PhotoService();
      },
      mounted() {
          this.productService.getProductsSmall().then((products) => {
              this.products = products;
          });
          this.photoService.getImages().then((images) => {
              this.images = images;
          });
      },
  };
  </script>
  
  <style lang="scss" scoped>
  .product-item {
      .product-item-content {
          border: 1px solid var(--surface-d);
          border-radius: 3px;
          margin: 0.3rem;
          text-align: center;
          padding: 2rem 0;
      }
      .product-image {
          width: 50%;
          box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
      }
  }
  
  .product-badge {
      border-radius: 2px;
      padding: 0.25em 0.5rem;
      text-transform: uppercase;
      font-weight: 700;
      font-size: 12px;
      letter-spacing: 0.3px;
      &.status-instock {
          background: #c8e6c9;
          color: #256029;
      }
      &.status-outofstock {
          background: #ffcdd2;
          color: #c63737;
      }
      &.status-lowstock {
          background: #feedaf;
          color: #8a5340;
      }
  }
  </style>