@ndla/ui 30.0.7 → 30.0.8
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/Article/Article.js +6 -12
- package/es/Article/index.js +1 -2
- package/es/LearningPaths/LearningPathMenu.js +5 -5
- package/es/LearningPaths/LearningPathMenuIntro.js +9 -14
- package/es/ResourceGroup/ResourceGroup.js +5 -8
- package/es/ResourceGroup/ResourceItem.js +13 -22
- package/es/ResourceGroup/ResourceList.js +4 -6
- package/es/index.js +1 -1
- package/es/locale/messages-en.js +2 -1
- package/es/locale/messages-nb.js +2 -1
- package/es/locale/messages-nn.js +2 -1
- package/es/locale/messages-se.js +2 -1
- package/es/locale/messages-sma.js +2 -1
- package/lib/Article/Article.d.ts +2 -3
- package/lib/Article/Article.js +6 -13
- package/lib/Article/index.d.ts +1 -2
- package/lib/Article/index.js +0 -8
- package/lib/LearningPaths/LearningPathMenu.d.ts +3 -2
- package/lib/LearningPaths/LearningPathMenu.js +5 -5
- package/lib/LearningPaths/LearningPathMenuIntro.d.ts +3 -2
- package/lib/LearningPaths/LearningPathMenuIntro.js +9 -15
- package/lib/ResourceGroup/ResourceGroup.d.ts +3 -3
- package/lib/ResourceGroup/ResourceGroup.js +5 -8
- package/lib/ResourceGroup/ResourceItem.d.ts +3 -4
- package/lib/ResourceGroup/ResourceItem.js +13 -23
- package/lib/ResourceGroup/ResourceList.d.ts +4 -4
- package/lib/ResourceGroup/ResourceList.js +4 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -7
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +2 -1
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +2 -1
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +2 -1
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +2 -1
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +2 -1
- package/package.json +10 -10
- package/src/.DS_Store +0 -0
- package/src/Article/Article.tsx +4 -14
- package/src/Article/index.ts +0 -2
- package/src/LearningPaths/LearningPathMenu.tsx +4 -4
- package/src/LearningPaths/LearningPathMenuIntro.tsx +4 -7
- package/src/ResourceGroup/ResourceGroup.tsx +4 -7
- package/src/ResourceGroup/ResourceItem.tsx +4 -15
- package/src/ResourceGroup/ResourceList.tsx +5 -8
- package/src/index.ts +0 -1
- package/src/locale/messages-en.ts +2 -1
- package/src/locale/messages-nb.ts +4 -2
- package/src/locale/messages-nn.ts +2 -1
- package/src/locale/messages-se.ts +2 -1
- package/src/locale/messages-sma.ts +2 -1
- package/es/Article/ArticleFavoritesButton.js +0 -42
- package/lib/Article/ArticleFavoritesButton.d.ts +0 -14
- package/lib/Article/ArticleFavoritesButton.js +0 -59
- package/src/Article/ArticleFavoritesButton.tsx +0 -42
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Copyright (c) 2022-present, NDLA.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import { IconButtonDualStates } from '@ndla/button';
|
|
12
|
-
import { Heart, HeartOutline } from '@ndla/icons/action';
|
|
13
|
-
import Tooltip from '@ndla/tooltip';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
export var ArticleFavoritesButton = function ArticleFavoritesButton(_ref) {
|
|
16
|
-
var isFavorite = _ref.isFavorite,
|
|
17
|
-
onToggleAddToFavorites = _ref.onToggleAddToFavorites,
|
|
18
|
-
articleId = _ref.articleId;
|
|
19
|
-
|
|
20
|
-
var _useTranslation = useTranslation(),
|
|
21
|
-
t = _useTranslation.t;
|
|
22
|
-
|
|
23
|
-
var removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
|
|
24
|
-
var addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
|
|
25
|
-
return _jsx(Tooltip, {
|
|
26
|
-
tooltip: isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel,
|
|
27
|
-
children: _jsx(IconButtonDualStates, {
|
|
28
|
-
ariaLabelActive: t('myNdla.alreadyFavourited'),
|
|
29
|
-
ariaLabelInActive: t('myNdla.addToFavourites'),
|
|
30
|
-
activeIcon: _jsx(Heart, {}),
|
|
31
|
-
inactiveIcon: _jsx(HeartOutline, {}),
|
|
32
|
-
active: isFavorite,
|
|
33
|
-
size: "small",
|
|
34
|
-
colorTheme: "light",
|
|
35
|
-
variant: "ghost",
|
|
36
|
-
onClick: function onClick() {
|
|
37
|
-
return onToggleAddToFavorites(articleId, !isFavorite);
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
export default ArticleFavoritesButton;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export interface Props {
|
|
9
|
-
isFavorite?: boolean;
|
|
10
|
-
onToggleAddToFavorites: (id: string, add: boolean) => void;
|
|
11
|
-
articleId: string;
|
|
12
|
-
}
|
|
13
|
-
export declare const ArticleFavoritesButton: ({ isFavorite, onToggleAddToFavorites, articleId }: Props) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
14
|
-
export default ArticleFavoritesButton;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.ArticleFavoritesButton = void 0;
|
|
7
|
-
|
|
8
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _button = require("@ndla/button");
|
|
13
|
-
|
|
14
|
-
var _action = require("@ndla/icons/action");
|
|
15
|
-
|
|
16
|
-
var _tooltip = _interopRequireDefault(require("@ndla/tooltip"));
|
|
17
|
-
|
|
18
|
-
var _reactI18next = require("react-i18next");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Copyright (c) 2022-present, NDLA.
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
26
|
-
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
var ArticleFavoritesButton = function ArticleFavoritesButton(_ref) {
|
|
30
|
-
var isFavorite = _ref.isFavorite,
|
|
31
|
-
onToggleAddToFavorites = _ref.onToggleAddToFavorites,
|
|
32
|
-
articleId = _ref.articleId;
|
|
33
|
-
|
|
34
|
-
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
35
|
-
t = _useTranslation.t;
|
|
36
|
-
|
|
37
|
-
var removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
|
|
38
|
-
var addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
|
|
39
|
-
return (0, _jsxRuntime.jsx)(_tooltip["default"], {
|
|
40
|
-
tooltip: isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel,
|
|
41
|
-
children: (0, _jsxRuntime.jsx)(_button.IconButtonDualStates, {
|
|
42
|
-
ariaLabelActive: t('myNdla.alreadyFavourited'),
|
|
43
|
-
ariaLabelInActive: t('myNdla.addToFavourites'),
|
|
44
|
-
activeIcon: (0, _jsxRuntime.jsx)(_action.Heart, {}),
|
|
45
|
-
inactiveIcon: (0, _jsxRuntime.jsx)(_action.HeartOutline, {}),
|
|
46
|
-
active: isFavorite,
|
|
47
|
-
size: "small",
|
|
48
|
-
colorTheme: "light",
|
|
49
|
-
variant: "ghost",
|
|
50
|
-
onClick: function onClick() {
|
|
51
|
-
return onToggleAddToFavorites(articleId, !isFavorite);
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
exports.ArticleFavoritesButton = ArticleFavoritesButton;
|
|
58
|
-
var _default = ArticleFavoritesButton;
|
|
59
|
-
exports["default"] = _default;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { IconButtonDualStates } from '@ndla/button';
|
|
11
|
-
import { Heart, HeartOutline } from '@ndla/icons/action';
|
|
12
|
-
import Tooltip from '@ndla/tooltip';
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
|
|
15
|
-
export interface Props {
|
|
16
|
-
isFavorite?: boolean;
|
|
17
|
-
onToggleAddToFavorites: (id: string, add: boolean) => void;
|
|
18
|
-
articleId: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const ArticleFavoritesButton = ({ isFavorite, onToggleAddToFavorites, articleId }: Props) => {
|
|
22
|
-
const { t } = useTranslation();
|
|
23
|
-
const removeFromFavoritesLabel = t('myNdla.resource.addToMyNdla');
|
|
24
|
-
const addToFavoritesLabel = t('myNdla.resource.addedToMyNdla');
|
|
25
|
-
return (
|
|
26
|
-
<Tooltip tooltip={isFavorite ? addToFavoritesLabel : removeFromFavoritesLabel}>
|
|
27
|
-
<IconButtonDualStates
|
|
28
|
-
ariaLabelActive={t('myNdla.alreadyFavourited')}
|
|
29
|
-
ariaLabelInActive={t('myNdla.addToFavourites')}
|
|
30
|
-
activeIcon={<Heart />}
|
|
31
|
-
inactiveIcon={<HeartOutline />}
|
|
32
|
-
active={isFavorite}
|
|
33
|
-
size="small"
|
|
34
|
-
colorTheme="light"
|
|
35
|
-
variant="ghost"
|
|
36
|
-
onClick={() => onToggleAddToFavorites(articleId, !isFavorite)}
|
|
37
|
-
/>
|
|
38
|
-
</Tooltip>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default ArticleFavoritesButton;
|