Skip to content

Commit

Permalink
feat(content-item): add component - FRONT-2499 (#2250)
Browse files Browse the repository at this point in the history
* init component

* update component

* update website

* add test

* apply latest specs

* update test

* add max width

* fix css

* update thumbnail

* fix after review

* fix print and markup

* Fix prettier

Co-authored-by: Alexis Gaillard <a@bypopcorn.com>
  • Loading branch information
emeryro and papegaill authored Dec 9, 2021
1 parent 023dcc5 commit c29abdd
Show file tree
Hide file tree
Showing 46 changed files with 2,156 additions and 331 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ Please contact [COMM Europa Management](mailto:Europamanagement@ec.europa.eu) fo

- v2.39.0: [sources](https://github.com/ec-europa/europa-component-library/tree/v2) - [release](https://github.com/ec-europa/europa-component-library/releases/tag/v2.39.0) - [website](https://ec.europa.eu/component-library/v2.39.0/)
- v1.15.0: [sources](https://github.com/ec-europa/europa-component-library/tree/v1) - [release](https://github.com/ec-europa/europa-component-library/releases/tag/v1.15.0) - [website](https://ec.europa.eu/component-library/v1.15.0/)
- v0.24.3: [sources](https://github.com/ec-europa/europa-component-library/tree/v0) - [release](https://github.com/ec-europa/europa-component-library/releases/tag/v0.24.3) - [website](https://ec.europa.eu/component-library/v0.24.3/)
- v0.24.3: [sources](https://github.com/ec-europa/europa-component-library/tree/v0) - [release](https://github.com/ec-europa/europa-component-library/releases/tag/v0.24.3) - [website](https://ec.europa.eu/component-library/v0.24.3/)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports[`Card Default renders correctly 1`] = `
<div
class="ecl-card__meta"
>
Meta1 | Meta2
META1 | Meta2
</div>
<h1
class="ecl-card__title"
Expand Down Expand Up @@ -176,7 +176,7 @@ exports[`Card Default renders correctly with extra attributes 1`] = `
<div
class="ecl-card__meta"
>
Meta1 | Meta2
META1 | Meta2
</div>
<h1
class="ecl-card__title"
Expand Down Expand Up @@ -311,7 +311,7 @@ exports[`Card Default renders correctly with extra class names 1`] = `
<div
class="ecl-card__meta"
>
Meta1 | Meta2
META1 | Meta2
</div>
<h1
class="ecl-card__title"
Expand Down Expand Up @@ -446,7 +446,7 @@ exports[`Card Default renders correctly with lists 1`] = `
<div
class="ecl-card__meta"
>
Meta1 | Meta2
META1 | Meta2
</div>
<h1
class="ecl-card__title"
Expand Down
2 changes: 2 additions & 0 deletions src/implementations/twig/components/content-item/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__snapshots__
*.js
127 changes: 127 additions & 0 deletions src/implementations/twig/components/content-item/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# ECL Content item component

npm package: `@ecl/twig-component-content-item`

```shell
npm install --save @ecl/twig-component-content-item
```

### Parameters

- **"variant"** (string) (default: ''): Variant of the content item (can be 'image-right' or 'event')
- **"image"** (associative array) (default: {}):
- "src" (string) (default: ''): Path to the image
- "size" (string) (default: 'm'): Size of the image (can be 's' or 'l')
- **"date"** (associative array) (default: {}): Predefined structure compatible with Date block component
- **"labels"** (array) (default: []): List of labels compatible with EC Label component structure
- **"meta"** (array) (default: []): Meta's for the Content item
- **"title"** (associative array) (default: {}): Predefined structure compatible with Link component
- **"description"** (string) (default: ''): Description of the Content item
- **"infos"** (array) (default: []): format: [
{
"label" (string) (default: ''): Label of info item
"icon" (associative array) (default: {}) A predefined structure compatible with Icon component
},
...
]
- **"lists"** (array) (default: []) Array of objects of type "description list". Used for taxonomy
- **"extra_classes"** (string) (default: '')
- **"extra_attributes"** (array) (default: []): format: [
{
"name" (string) (default: ''),
"value" (optional) (string)
...
],

<!-- prettier-ignore -->
```twig
{% include '@ecl/content-item/content-item.html.twig' with {
image: {
src: 'https://inno-ecl.s3.amazonaws.com/media/examples/example-image.jpg',
size: 'l',
},
labels: [
{ label: 'highlight', variant: 'highlight' },
{ label: 'high importance', variant: 'high' },
],
meta: ['PRIMARY META', 'DD Month Year'],
title: {
type: 'standalone',
label: 'Title',
path: exampleLink,
},
description:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida ipsum ut lorem cursus, quis tincidunt sem viverra. Nunc vestibulum, mauris quis porta venenatis, justo odio commodo tellus',
infos: [
{
icon: {
name: 'calendar',
size: 'xs',
path: '/icons.svg',
},
label: '2018/10/22',
},
{
icon: {
name: 'location',
size: 'xs',
path: '/icons.svg',
},
label: 'Luxembourg',
},
],
lists: [
{
items: [
{
term: 'Science areas',
definition: [
{
label: 'Energy and transport',
variant: 'display',
},
{
label: 'Standards',
variant: 'display',
},
],
},
{
term: 'Keywords',
definition: [
{
label: 'Electricity',
variant: 'display',
},
{
label: 'Electromobility',
variant: 'display',
},
{
label: 'Energy',
variant: 'display',
},
{
label: 'Energy storage',
variant: 'display',
},
{
label: 'Security',
variant: 'display',
},
{
label: 'Transport',
variant: 'display',
},
{
label: 'Low carbon',
variant: 'display',
},
],
},
],
variant: 'taxonomy',
},
],
} %}
```
Loading

1 comment on commit c29abdd

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.