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(content-item): add component - FRONT-2499 #2250

Merged
merged 21 commits into from
Dec 9, 2021
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
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
papegaill marked this conversation as resolved.
Show resolved Hide resolved
</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