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

Item with icon stackable #220

Merged
merged 3 commits into from
Aug 16, 2022
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
37 changes: 30 additions & 7 deletions src/ui/Item/ItemGroupWithIcons.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,26 @@ import Knowledge from '@eeacms/volto-eea-design-system/../theme/themes/eea/asset
export default {
title: 'Components/Item/Item group with icons',
component: Item,
argTypes: {},
argTypes: {
stackable: {
description: 'Image above content',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
},
},
},
};

function SingleItem({ image, imageSize, description, verticalAlign }) {
function SingleItem({
image,
imageSize,
description,
verticalAlign,
stackable,
}) {
return (
<Item>
{/* <Item.Image size={imageSize == 'default' ? '' : imageSize} src={image} alt="item image" /> */}
<Item className={stackable ? 'stackable' : ''}>
<Item.Image className={`ui ${imageSize}`} src={image} alt="item image" />
<Item.Content verticalAlign={verticalAlign}>{description}</Item.Content>
</Item>
Expand All @@ -32,8 +45,9 @@ export const DefaultItem = (args) => (
</Container>
);
DefaultItem.args = {
imageSize: 'default',
imageSize: 'tile',
verticalAlign: 'middle',
stackable: false,
image: GlobeEco,
description:
'Support Europe’s transition to a sustainable future with evidence-based knowledge and data.',
Expand Down Expand Up @@ -73,7 +87,13 @@ DefaultItem.argTypes = {
},
};

function ItemGroup({ imageSize, verticalAlign, ColumnLeft, ColumnRight }) {
function ItemGroup({
imageSize,
verticalAlign,
ColumnLeft,
ColumnRight,
stackable,
}) {
return (
<Container>
<Grid>
Expand All @@ -86,6 +106,7 @@ function ItemGroup({ imageSize, verticalAlign, ColumnLeft, ColumnRight }) {
{...item}
imageSize={imageSize}
verticalAlign={verticalAlign}
stackable={stackable}
></SingleItem>
))}
</Item.Group>
Expand All @@ -98,6 +119,7 @@ function ItemGroup({ imageSize, verticalAlign, ColumnLeft, ColumnRight }) {
{...item}
imageSize={imageSize}
verticalAlign={verticalAlign}
stackable={stackable}
></SingleItem>
))}
</Item.Group>
Expand All @@ -113,8 +135,9 @@ const Template = (args) => <ItemGroup {...args}></ItemGroup>;
// Group of items
export const DefaultGroup = Template.bind({});
DefaultGroup.args = {
imageSize: 'mini',
imageSize: 'tile',
verticalAlign: 'middle',
stackable: false,
ColumnLeft: [
{
childKey: 0,
Expand Down
16 changes: 15 additions & 1 deletion theme/themes/eea/views/item.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,26 @@
margin-bottom: 0;
}

// Stackable items that have image above content
.ui.items.row .item.stackable {
display: grid;

.image {
margin: auto;
}

.content {
padding-left: @stackableContentPaddingLeft;
padding-top: @stackableContentPaddingTop;
}
}

@media only screen and (max-width: @largestMobileScreen) {
.ui.items.row > .item {
flex-direction: row;
}

.ui.items.row > .item > .image + .content {
.ui.items.row > .item:not(.stackable) > .image + .content {
padding: 0em 0em 0em @mobileContentImageDistance;
}
}
Expand Down
7 changes: 5 additions & 2 deletions theme/themes/eea/views/item.variables
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@
@dividedFirstLastMargin: 0em;
@dividedFirstLastPadding: 0em;


/* Unstackable */
/* Unstackable items */
@unstackableMobileImageWidth: 125px;

/* Stackable item */
@stackableContentPaddingTop: @rem-space-4;
@stackableContentPaddingLeft: 0;

/* Row */
@mobileRowItemMargin : 1rem 0;
@tabletRowItemMargin : 1.5rem 0;
Expand Down