forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cxl-ui): cxl-featured-image add component
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |