We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a8cf09a + afde73e commit 7e3cdb3Copy full SHA for 7e3cdb3
4 files changed
src/components/objectOverlay/CdrObjectOverlay.vue
@@ -1,31 +1,11 @@
1
<script setup lang="ts">
2
import { useCssModule, computed } from 'vue';
3
-import {
4
- ObjectPosition,
5
- ResponsivePosition,
6
- ResponsiveSpace,
7
- Spacing,
8
- Gradient,
9
- ResponsiveGradient
10
-} from '../../types/interfaces';
+import type { ObjectOverlayProps } from '../../types/interfaces';
11
12
/** Component for positioning content in 9 different positions relative to a container */
13
14
defineOptions({ name: 'CdrObjectOverlay' });
15
16
-interface ObjectOverlayProps {
17
- /** Gradient to be applied to the container */
18
- gradient?: ResponsiveGradient | Gradient;
19
- /** Position of the content relative to the container */
20
- position?: ResponsivePosition | ObjectPosition;
21
- /** Margin space around the positioned content */
22
- margin?: ResponsiveSpace | Spacing;
23
- /** Padding space around the positioned content */
24
- padding?: ResponsiveSpace | Spacing;
25
- /** Sets the HTML tag for the container element */
26
- tag?: string;
27
-}
28
-
29
const props = withDefaults(defineProps<ObjectOverlayProps>(), {
30
position: 'center-center',
31
margin: 'zero',
src/components/objectOverlay/examples/ObjectOverlay.vue
@@ -9,8 +9,6 @@ import CdrTitle from '../../title/CdrTitle.vue';
import CdrButton from '../../button/CdrButton.vue';
import CdrIcon from '../../icon/CdrIcon.vue';
import cedarImage from '../../../dev/static/cedar-1920x1080.jpg';
-import cedarSquareImage from '../../../dev/static/cedar-1080x1080.jpg';
-import cedarTallImage from '../../../dev/static/cedar-1080x1920.jpg';
defineOptions({ name: 'ObjectOverlay' });
@@ -100,7 +98,16 @@ const overlayExamples = [
100
98
</template>
101
99
</CdrLayout>
102
103
- <hr />
+ <CdrObjectOverlay :position="{ xs: 'center-center', lg: 'bottom-center', md: 'bottom-left' }" :margin="['zero', 'eighth-x']">
+ <template #container>
+ <img src="https://placehold.co/600x400" width="100%" height="100%" alt="Background image" :style="{ display: 'block' }"/>
104
+ </template>
105
+ <template #content>
106
+ <div class="overlay-content" :style="{ backgroundColor: '#fff', padding: '20px' }">
107
+ Positioned Content
108
+ </div>
109
110
+ </CdrObjectOverlay>
111
112
<h2>Media Object with Multiple Overlays</h2>
113
<CdrMediaObject>
src/components/objectOverlay/styles/CdrObjectOverlay.module.scss
@@ -21,10 +21,10 @@ $positions: (
);
$gradients: (
- 'to-top': linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent),
- 'to-bottom': linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent),
- 'to-left': linear-gradient(to left, rgba(0, 0, 0, 0.5), transparent),
- 'to-right': linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent)
+ 'to-top': linear-gradient(to top, black 0%, rgba(0, 0, 0, 0.55) 40%, transparent),
+ 'to-bottom': linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.55) 40%, transparent),
+ 'to-left': linear-gradient(to left, black 0%, rgba(0, 0, 0, 0.55) 40%, transparent),
+ 'to-right': linear-gradient(to right, black 0%, rgba(0, 0, 0, 0.55) 40%, transparent)
.cdr-object-overlay {
src/types/interfaces.ts
@@ -435,3 +435,16 @@ export type ResponsiveSpace = {
435
md?: Spacing;
436
lg?: Spacing;
437
};
438
+
439
+export interface ObjectOverlayProps {
440
+ /** Gradient to be applied to the container */
441
+ gradient?: ResponsiveGradient | Gradient;
442
+ /** Position of the content relative to the container */
443
+ position?: ResponsivePosition | ObjectPosition;
444
+ /** Margin space around the positioned content */
445
+ margin?: ResponsiveSpace | Spacing;
446
+ /** Padding space around the positioned content */
447
+ padding?: ResponsiveSpace | Spacing;
448
+ /** Sets the HTML tag for the container element */
449
+ tag?: string;
450
+}
0 commit comments