Skip to content

Commit

Permalink
Merge branch 'v2-dev' into fix/a11y-issues-INNO-1831
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuard committed Oct 1, 2019
2 parents cf9dc2d + ebb27e5 commit decdc42
Show file tree
Hide file tree
Showing 13 changed files with 561 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from './src/FooterCore';
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"private": true,
"name": "@ecl/ec-react-component-footer-core",
"author": "European Commission",
"license": "EUPL-1.1",
"version": "2.11.0",
"description": "ECL EC React Footer Core",
"main": "index.js",
"module": "index.js",
"dependencies": {
"@ecl/ec-react-component-link": "^2.11.0"
},
"devDependencies": {
"@ecl/ec-component-footer-core": "^2.11.0",
"@ecl/ec-layout-grid": "^2.11.0",
"@ecl/ec-specs-footer-core": "^2.11.0"
},
"peerDependencies": {
"classnames": "^2.2.6",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dom": "^16.4.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

import Link from '@ecl/ec-react-component-link';

const FooterCore = ({ sections, className, ...props }) => (
<footer {...props} className={classnames(className, 'ecl-footer-core')}>
<div className="ecl-container ecl-footer-core__container">
{sections.map((section, index) => (
<div
className={classnames(
'ecl-footer-core__section',
`ecl-footer-core__section${index + 1}`,
section.sectionClassName
)}
key={section.key}
>
{!!(section.title && typeof section.title === 'object') && (
<Link
{...section.title}
variant="standalone"
className={classnames(
section.titleClassName,
'ecl-footer-core__title'
)}
/>
)}
{!!(section.title && typeof section.title === 'string') && (
<div
className={classnames(
'ecl-footer-core__title',
section.titleClassName
)}
>
{section.title}
</div>
)}
{section.description && (
<div
className={classnames(
'ecl-footer-core__description',
section.descriptionClassName
)}
>
{section.description}
</div>
)}
{section.contentBefore && (
<div
className={classnames(
'ecl-footer-core__content',
section.contentBeforeClassName
)}
>
{section.contentBefore}
</div>
)}
{section.links && (
<ul
className={classnames(
'ecl-footer-core__list',
section.listClassName
)}
>
{section.links.map(link => (
<li className="ecl-footer-core__list-item" key={link.label}>
<Link
{...link}
variant="standalone"
className={classnames(
link.className,
'ecl-footer-core__link'
)}
/>
</li>
))}
</ul>
)}
{section.contentAfter && (
<div
className={classnames(
'ecl-footer-core__content',
section.contentAfterClassName
)}
>
{section.contentAfter}
</div>
)}
</div>
))}
</div>
</footer>
);

FooterCore.propTypes = {
sections: PropTypes.arrayOf(
PropTypes.shape({
key: PropTypes.string,
title: PropTypes.oneOfType(
PropTypes.string,
PropTypes.shape(Link.propTypes)
),
description: PropTypes.string,
contentBefore: PropTypes.string,
links: PropTypes.arrayOf(PropTypes.shape(Link.propTypes)),
contentAfter: PropTypes.string,
})
),
className: PropTypes.string,
};

FooterCore.defaultProps = {
sections: [],
className: '',
};

export default FooterCore;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';

import demoContent from '@ecl/ec-specs-footer-core/demo/data';

import FooterCore from '../src/FooterCore';

storiesOf('Components|Footers/Core', module)
.addDecorator(withKnobs)
.add('default', () => <FooterCore {...demoContent} />);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# EC Footer Core

(Work in progress)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Footer Core component
* @define footer-core
*/

// Import base
@import '@ecl/ec-base/ec-base';

@mixin ecl-footer-core-print() {
.ecl-footer-core {
display: none;
}
}

// Use mixin
@include exports('ec-component-footer-core-print') {
@include ecl-footer-core-print();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/**
* Footer Core component
* @define footer-core
*/

// Import base
@import '@ecl/ec-base/ec-base';

// Check if overridden dependencies are already loaded, if needed
@include check-imports(('ec-layout-grid', 'ec-component-link'));

/* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */
@mixin ecl-footer-core(
$bg-color: $ecl-color-blue,
$separator-color: $ecl-color-blue-50,
$text-color: $ecl-color-white,
$column-gap: $ecl-grid-gutter-width
) {
/*
* Global rules
*/
.ecl-footer-core {
background-color: $bg-color;
color: $text-color;
margin: 0;
padding-bottom: $ecl-spacing-xl;
}

.ecl-footer-core__container {
display: flex;
flex-direction: column;
}

.ecl-footer-core__section {
margin-top: $ecl-spacing-l;

&:first-of-type {
margin-top: $ecl-spacing-xl;
}

> :first-child {
margin-top: 0;
}
}

.ecl-footer-core__section--separator {
border-bottom: 1px solid $separator-color;
padding-bottom: $ecl-spacing-l;
}

.ecl-footer-core__title,
.ecl-footer-core__title:hover,
.ecl-footer-core__title:focus,
.ecl-footer-core__title:active {
color: $text-color;
font: $ecl-font-m;
font-weight: $ecl-font-weight-bold;
}

.ecl-footer-core__title--separator {
border-bottom: 1px solid $separator-color;
padding-bottom: $ecl-spacing-xs;
}

.ecl-footer-core__description {
color: $ecl-color-blue-25;
font: $ecl-font-prolonged-s;
margin-top: $ecl-spacing-xs;
}

.ecl-footer-core__content {
font: $ecl-font-s;
margin-top: $ecl-spacing-xs;
}

.ecl-footer-core__list {
list-style: none;
margin-bottom: 0;
margin-top: $ecl-spacing-xs;
padding-left: 0;
}

.ecl-footer-core__list-item {
margin-top: $ecl-spacing-m;

.ecl-footer-core__list--condensed & {
margin-top: $ecl-spacing-xs;
}

&:first-of-type {
margin-top: 0;
}
}

.ecl-footer-core__list--inline {
display: inline-flex;
flex-wrap: wrap;

.ecl-footer-core__list-item {
margin-right: $ecl-spacing-l;
margin-top: 0;

/* stylelint-disable-next-line max-nesting-depth */
&:last-of-type {
margin-right: 0;
}
}
}

.ecl-footer-core__link {
font: $ecl-font-s;
}

.ecl-footer-core__link,
.ecl-footer-core__link:hover,
.ecl-footer-core__link:active,
.ecl-footer-core__link:focus {
color: $text-color;
}

/* stylelint-disable-next-line order/order */
@include ecl-media-breakpoint-up('md') {
.ecl-footer-core__section {
margin-top: $ecl-spacing-xl;
}

.ecl-footer-core__section--separator {
border-bottom-width: 2px;
padding-bottom: $ecl-spacing-xl;
}

.ecl-footer-core__title,
.ecl-footer-core__title:hover,
.ecl-footer-core__title:focus,
.ecl-footer-core__title:active {
font: $ecl-font-prolonged-m;
font-weight: $ecl-font-weight-bold;
}

.ecl-footer-core__title--separator {
border-bottom-width: 2px;
}

.ecl-footer-core__description {
margin-top: $ecl-spacing-xl;
}

.ecl-footer-core__list--columns {
column-count: 2;
}

.ecl-footer-core__link {
font: $ecl-font-prolonged-s;
}
}

/*
* Section related rules
*/
.ecl-footer-core__section4 {
margin-top: $ecl-spacing-m;
}

/* stylelint-disable-next-line order/order */
@include ecl-media-breakpoint-up('md') {
/* Grid layout */
.ecl-footer-core__container {
column-gap: $column-gap;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, minmax(min-content, max-content));
row-gap: 0;
}

.ecl-footer-core__section1 {
grid-area: 1 / 1 / 3 / 2;
}

.ecl-footer-core__section2 {
grid-area: 1 / 2 / 2 / 4;
}

.ecl-footer-core__section3 {
grid-area: 2 / 2 / 3 / 3;
}

.ecl-footer-core__section4 {
grid-area: 2 / 3 / 3 / 4;
margin-top: $ecl-spacing-xl;
}
}
}

// Use mixin
@include exports('ec-component-footer-core') {
@include ecl-footer-core();
}
Loading

0 comments on commit decdc42

Please sign in to comment.