@ndla/ui 22.3.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/ResourceBox/ResourceBox.js +7 -35
- package/es/all.css +1 -1
- package/lib/ResourceBox/ResourceBox.d.ts +1 -4
- package/lib/ResourceBox/ResourceBox.js +15 -35
- package/lib/all.css +1 -1
- package/package.json +2 -2
- package/src/ResourceBox/ResourceBox.tsx +1 -20
- package/src/main.scss +0 -1
- package/es/BackgroundImage/BackgroundImage.js +0 -27
- package/es/BackgroundImage/index.js +0 -2
- package/lib/BackgroundImage/BackgroundImage.d.ts +0 -12
- package/lib/BackgroundImage/BackgroundImage.js +0 -40
- package/lib/BackgroundImage/index.d.ts +0 -2
- package/lib/BackgroundImage/index.js +0 -13
- package/src/BackgroundImage/BackgroundImage.tsx +0 -32
- package/src/BackgroundImage/component.background-image.scss +0 -52
- package/src/BackgroundImage/index.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "2f0095b2f2c730ff16d8c71fa8e867db87607c66"
|
|
89
89
|
}
|
|
@@ -10,7 +10,6 @@ import React from 'react';
|
|
|
10
10
|
import { breakpoints, fonts, mq, colors, spacing } from '@ndla/core';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import { Launch } from '@ndla/icons/common';
|
|
13
|
-
import { LicenseByline } from '@ndla/licenses';
|
|
14
13
|
import { SafeLinkButton } from '@ndla/safelink';
|
|
15
14
|
import styled from '@emotion/styled';
|
|
16
15
|
import Image from '../Image';
|
|
@@ -81,12 +80,6 @@ const StyledImage = styled(Image)`
|
|
|
81
80
|
}
|
|
82
81
|
`;
|
|
83
82
|
|
|
84
|
-
const LincenseWrapper = styled.div`
|
|
85
|
-
position: absolute;
|
|
86
|
-
top: 9px;
|
|
87
|
-
right: 0;
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
83
|
interface ImageMeta {
|
|
91
84
|
src: string;
|
|
92
85
|
alt: string;
|
|
@@ -96,25 +89,13 @@ interface Props {
|
|
|
96
89
|
image: ImageMeta;
|
|
97
90
|
title: string;
|
|
98
91
|
caption: string;
|
|
99
|
-
licenseRights: string[];
|
|
100
|
-
authors?: string[];
|
|
101
|
-
locale?: string;
|
|
102
92
|
url: string;
|
|
103
93
|
}
|
|
104
94
|
|
|
105
|
-
export const ResourceBox = ({ image, title, caption,
|
|
95
|
+
export const ResourceBox = ({ image, title, caption, url }: Props) => {
|
|
106
96
|
const { t } = useTranslation();
|
|
107
97
|
return (
|
|
108
98
|
<ResourceBoxContainer>
|
|
109
|
-
<LincenseWrapper>
|
|
110
|
-
<LicenseByline licenseRights={licenseRights} locale={locale} marginRight color={colors.brand.tertiary}>
|
|
111
|
-
{authors && authors.length > 0 && (
|
|
112
|
-
<div className="c-figure__byline-author-buttons">
|
|
113
|
-
<span className="c-figure__byline-authors">{authors.join(' ')}</span>
|
|
114
|
-
</div>
|
|
115
|
-
)}
|
|
116
|
-
</LicenseByline>
|
|
117
|
-
</LincenseWrapper>
|
|
118
99
|
<StyledImage src={image.src} alt={image.alt} />
|
|
119
100
|
<ContentWrapper>
|
|
120
101
|
<Title>{title}</Title>
|
package/src/main.scss
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
@import 'Aside/component.aside';
|
|
17
17
|
@import 'Article/component.footnotes';
|
|
18
18
|
@import 'NoContentBox/component.no-content-box.scss';
|
|
19
|
-
@import 'BackgroundImage/component.background-image';
|
|
20
19
|
@import 'Portrait/component.portrait.scss';
|
|
21
20
|
@import 'global/components/component.logo';
|
|
22
21
|
@import 'MediaList/component.medialist';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import BEMHelper from 'react-bem-helper';
|
|
5
|
-
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
6
|
-
var classes = BEMHelper('c-background-image');
|
|
7
|
-
|
|
8
|
-
var BackgroundImage = function BackgroundImage(_ref) {
|
|
9
|
-
var images = _ref.images,
|
|
10
|
-
_ref$showOverlay = _ref.showOverlay,
|
|
11
|
-
showOverlay = _ref$showOverlay === void 0 ? false : _ref$showOverlay;
|
|
12
|
-
return ___EmotionJSX("div", classes('', {
|
|
13
|
-
showOverlay: showOverlay
|
|
14
|
-
}), images && images.map(function (image) {
|
|
15
|
-
return image.types.map(function (type) {
|
|
16
|
-
return ___EmotionJSX("div", _extends({
|
|
17
|
-
key: "".concat(image.url).concat(type)
|
|
18
|
-
}, classes('background', type), {
|
|
19
|
-
style: {
|
|
20
|
-
backgroundImage: "url(".concat(image.url, ")")
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
});
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default BackgroundImage;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare type ImageType = 'mobile' | 'tablet' | 'desktop' | 'wide';
|
|
3
|
-
interface Props {
|
|
4
|
-
showOverlay?: boolean;
|
|
5
|
-
className?: string;
|
|
6
|
-
images: {
|
|
7
|
-
url: string;
|
|
8
|
-
types: ImageType[];
|
|
9
|
-
}[];
|
|
10
|
-
}
|
|
11
|
-
declare const BackgroundImage: ({ images, showOverlay }: Props) => JSX.Element;
|
|
12
|
-
export default BackgroundImage;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
-
|
|
12
|
-
var _core = require("@emotion/core");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
-
|
|
18
|
-
var classes = (0, _reactBemHelper["default"])('c-background-image');
|
|
19
|
-
|
|
20
|
-
var BackgroundImage = function BackgroundImage(_ref) {
|
|
21
|
-
var images = _ref.images,
|
|
22
|
-
_ref$showOverlay = _ref.showOverlay,
|
|
23
|
-
showOverlay = _ref$showOverlay === void 0 ? false : _ref$showOverlay;
|
|
24
|
-
return (0, _core.jsx)("div", classes('', {
|
|
25
|
-
showOverlay: showOverlay
|
|
26
|
-
}), images && images.map(function (image) {
|
|
27
|
-
return image.types.map(function (type) {
|
|
28
|
-
return (0, _core.jsx)("div", _extends({
|
|
29
|
-
key: "".concat(image.url).concat(type)
|
|
30
|
-
}, classes('background', type), {
|
|
31
|
-
style: {
|
|
32
|
-
backgroundImage: "url(".concat(image.url, ")")
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
});
|
|
36
|
-
}));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var _default = BackgroundImage;
|
|
40
|
-
exports["default"] = _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _BackgroundImage = _interopRequireDefault(require("./BackgroundImage"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = _BackgroundImage["default"];
|
|
13
|
-
exports["default"] = _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import BEMHelper from 'react-bem-helper';
|
|
3
|
-
|
|
4
|
-
const classes = BEMHelper('c-background-image');
|
|
5
|
-
|
|
6
|
-
type ImageType = 'mobile' | 'tablet' | 'desktop' | 'wide';
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
showOverlay?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
images: {
|
|
12
|
-
url: string;
|
|
13
|
-
types: ImageType[];
|
|
14
|
-
}[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const BackgroundImage = ({ images, showOverlay = false }: Props) => (
|
|
18
|
-
<div {...classes('', { showOverlay })}>
|
|
19
|
-
{images &&
|
|
20
|
-
images.map((image) =>
|
|
21
|
-
image.types.map((type) => (
|
|
22
|
-
<div
|
|
23
|
-
key={`${image.url}${type}`}
|
|
24
|
-
{...classes('background', type)}
|
|
25
|
-
style={{ backgroundImage: `url(${image.url})` }}
|
|
26
|
-
/>
|
|
27
|
-
)),
|
|
28
|
-
)}
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export default BackgroundImage;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
.c-background-image {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 0;
|
|
4
|
-
bottom: 0;
|
|
5
|
-
left: 0;
|
|
6
|
-
right: 0;
|
|
7
|
-
|
|
8
|
-
&--showOverlay {
|
|
9
|
-
.c-background-image__background:after {
|
|
10
|
-
content: '';
|
|
11
|
-
position: absolute;
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
|
-
background: rgba(0, 0, 0, 0.3);
|
|
15
|
-
z-index: 0;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&__background {
|
|
20
|
-
position: absolute;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
background-size: cover;
|
|
24
|
-
background-repeat: no-repeat;
|
|
25
|
-
background-position: center;
|
|
26
|
-
|
|
27
|
-
&--mobile {
|
|
28
|
-
display: none;
|
|
29
|
-
@include mq($from: mobile, $until: tablet) {
|
|
30
|
-
display: block;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
&--tablet {
|
|
34
|
-
display: none;
|
|
35
|
-
@include mq($from: tablet, $until: desktop) {
|
|
36
|
-
display: block;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
&--desktop {
|
|
40
|
-
display: none;
|
|
41
|
-
@include mq($from: desktop, $until: wide) {
|
|
42
|
-
display: block;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
&--wide {
|
|
46
|
-
display: none;
|
|
47
|
-
@include mq($from: wide) {
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|