Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cxl-ui): cxl-featured-image add component #413

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions packages/cxl-ui/scss/cxl-featured-image.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// stylelint-disable order/properties-order

@use "~@conversionxl/cxl-lumo-styles/scss/mq";

:host {
position: relative;
display: block;
height: 25vh;
min-width: 320px;

@media #{mq.$medium} {
display: none;
}

#container {
position: absolute;
bottom: 0;
width: 100%;
height: 75%;
background-color: var(--cxl-brand-color-black, rgb(26, 26, 26));
pawelkmpt marked this conversation as resolved.
Show resolved Hide resolved
border-radius: calc(3 * var(--lumo-border-radius-l));
}

#image {
position: absolute;
width: 100%;
height: 100%;
background-repeat: no-repeat;
background-position-x: center;
background-position-y: bottom;
background-size: contain;
}
}

:host(.black) {
#container {
background-color: var(--cxl-brand-color-black);
}
}

:host(.blue) {
#container {
background-color: var(--cxl-brand-color-blue);
}
}

:host(.green) {
#container {
background-color: var(--cxl-brand-color-green);
}
}

:host(.light-blue) {
#container {
background-color: var(--cxl-brand-color-light-blue);
}
}

:host(.red) {
#container {
background-color: var(--lumo-primary-color);
}
}
20 changes: 20 additions & 0 deletions packages/cxl-ui/src/components/cxl-featured-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable import/no-extraneous-dependencies */
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import cxlFeaturedImageStyles from '../styles/cxl-featured-image-css.js';

@customElement('cxl-featured-image')
export class CXLFeaturedImage extends LitElement {
@property({ type: String }) src = '';

static get styles() {
return [cxlFeaturedImageStyles];
}

render() {
return html`
<div id="container"></div>
<div id="image" style="background-image: url(${this.src})"></div>
`;
}
}
1 change: 1 addition & 0 deletions packages/cxl-ui/src/index-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export { CXLAppLayoutElement } from './components/cxl-app-layout.js';
export { CXLBaseCardElement } from './components/cxl-base-card.js';
export { CXLCardElement } from './components/cxl-card.js';
export { CXLCourseCardElement } from './components/cxl-course-card.js';
export { CXLFeaturedImage } from './components/cxl-featured-image';
export { CXLLightCardElement } from './components/cxl-light-card.js';
export { CXLNotification } from './components/cxl-notification.js';
export { CXLSectionElement } from './components/cxl-section.js';
Expand Down
17 changes: 17 additions & 0 deletions packages/storybook/cxl-ui/cxl-featured-image.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-featured-image.js';

export default {
title: 'CXL UI/cxl-featured-image',
parameters: {
layout: 'centered',
},
};

export const CXLFeaturedImage = ({ src }) =>
html`<cxl-featured-image src=${src}></cxl-featured-image>`;

CXLFeaturedImage.storyName = 'cxl-featured-image';
CXLFeaturedImage.args = {
src: 'https://ebpyu8ye7bj.exactdn.com/institute/wp-content/uploads/2023/12/ben-labay_team_headshot-1x1-bw-min-fix-min-compressed.png?strip=all&lossy=1&fit=720%2C720&ssl=1',
};
Loading