forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 8
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-card-grid component, light and course card examples #370
Open
HenerHoop
wants to merge
2
commits into
master
Choose a base branch
from
hener/feat/cxl-card-grid
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,28 @@ | ||
@use "~@conversionxl/cxl-lumo-styles/scss/mq"; | ||
|
||
:host { | ||
position: relative; | ||
display: block; | ||
|
||
::slotted(.grid) { | ||
display: grid; | ||
grid-template-columns: repeat(1, 1fr); | ||
gap: var(--lumo-space-m); | ||
|
||
@media #{mq.$medium} { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
|
||
@media #{mq.$large} { | ||
grid-template-columns: repeat(4, 1fr); | ||
} | ||
} | ||
} | ||
|
||
:host([theme~="courses"]) { | ||
::slotted(.grid) { | ||
@media #{mq.$large} { | ||
grid-template-columns: repeat(3, 1fr); | ||
} | ||
} | ||
} |
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,7 @@ | ||
cxl-card-grid { | ||
cxl-light-card, | ||
cxl-course-card { | ||
width: 100%; | ||
max-width: none; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem. By styling the component |
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,30 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { LitElement, html } from 'lit'; | ||
import { customElement } from 'lit/decorators.js'; | ||
|
||
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils'; | ||
|
||
import '@conversionxl/cxl-lumo-styles'; | ||
import cxlCardGridStyles from '../styles/cxl-card-grid-css.js'; | ||
import cxlCardGridGlobalStyles from '../styles/global/cxl-card-grid-css.js'; | ||
|
||
@customElement('cxl-card-grid') | ||
export class CxlCardGridElement extends LitElement { | ||
static get styles() { | ||
return [cxlCardGridStyles]; | ||
} | ||
|
||
render() { | ||
return html`<slot></slot>`; | ||
} | ||
|
||
firstUpdated(_changedProperties) { | ||
super.firstUpdated(_changedProperties); | ||
|
||
// Global styles. | ||
registerGlobalStyles(cxlCardGridGlobalStyles, { | ||
moduleId: 'cxl-card-grid-global', | ||
}); | ||
} | ||
|
||
} |
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
42 changes: 42 additions & 0 deletions
42
packages/storybook/cxl-ui/cxl-course-card/course-card-grid.stories.js
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,42 @@ | ||
import { html } from 'lit'; | ||
import { CourseCardTemplate } from './template.js'; | ||
|
||
import '@conversionxl/cxl-ui/src/components/cxl-course-card.js'; | ||
import '@conversionxl/cxl-ui/src/components/cxl-card-grid.js'; | ||
import '@conversionxl/cxl-lumo-styles'; | ||
|
||
export default { | ||
title: 'CXL UI/cxl-course-card-grid', | ||
}; | ||
|
||
const CXLCourseCard = CourseCardTemplate.bind({}); | ||
CXLCourseCard.args = { | ||
id: 'cxl-course-1', | ||
name: 'Account based marketing', | ||
time: '3h 00min', | ||
instructor: 'Tom Wesseling', | ||
description: | ||
'Master the strategies, tactics, metrics, and wisdom you need to become an ABM leader and accelerate the growth of your company and of your career.', | ||
theme: 'course', | ||
tags: 'Marketing, Analytics, Growth, Demand Capture', | ||
avatar: | ||
'https://cxl.com/institute/wp-content/uploads/2020/05/48192546_10156982340630746_8127333122065825792_n-wpv_400pxx400px_center_center.jpg', | ||
new: false, | ||
showTimeIcon: true, | ||
}; | ||
|
||
export const CXLCourseCardGrid = ({ length, args }) => html` | ||
<cxl-card-grid theme="courses"> | ||
<div class="grid"> | ||
${Array.from({ length }, () => html` | ||
<div class="col"> | ||
${CXLCourseCard({ ...CXLCourseCard.args, ...args })} | ||
</div> | ||
`)} | ||
</div> | ||
</cxl-card-grid> | ||
`; | ||
|
||
CXLCourseCardGrid.args = { | ||
length: 12, | ||
}; |
35 changes: 35 additions & 0 deletions
35
packages/storybook/cxl-ui/cxl-light-card/light-card-grid.stories.js
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,35 @@ | ||
import { html } from 'lit'; | ||
import { Template } from './template.js'; | ||
|
||
import '@conversionxl/cxl-ui/src/components/cxl-light-card.js'; | ||
import '@conversionxl/cxl-ui/src/components/cxl-card-grid.js'; | ||
import '@conversionxl/cxl-lumo-styles'; | ||
|
||
export default { | ||
title: 'CXL UI/cxl-light-card-grid', | ||
}; | ||
|
||
const CXLLightCard = Template.bind({}); | ||
CXLLightCard.args = { | ||
theme: 'light-card', | ||
name: 'Account based marketing', | ||
avatar: 'https://cxl.com/institute/wp-content/uploads/2020/05/48192546_10156982340630746_8127333122065825792_n-wpv_400pxx400px_center_center.jpg', | ||
instructor: 'Lorem Ipsum', | ||
completed: true, | ||
}; | ||
|
||
export const CXLLightCardGrid = ({ length, args }) => html` | ||
<cxl-card-grid> | ||
<div class="grid"> | ||
${Array.from({ length }, () => html` | ||
<div class="col"> | ||
${CXLLightCard({ ...CXLLightCard.args, ...args })} | ||
</div> | ||
`)} | ||
</div> | ||
</cxl-card-grid> | ||
`; | ||
|
||
CXLLightCardGrid.args = { | ||
length: 12, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the need to slot in a
.grid
element? If we style the host itself to be the grid container, we achieve the same result and allow parent elements to adapt the style if needed. That's important in our setup, to be able to easily re-use the element in wp and make changes by applying desired classes. Just slot the cards directly.