@penskemediacorp/larva-patterns 1.60.1-alpha.0 → 1.62.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/_data/social-platforms.json +66 -0
- package/components/c-icon/c-icon.twig +16 -12
- package/modules/author-blurb/author-blurb.prototype.js +7 -4
- package/modules/author-details/author-details.prototype.js +5 -3
- package/modules/footer-social/footer-social.prototype.js +6 -4
- package/modules/header-sticky/header-sticky.article.js +8 -4
- package/modules/social-share/social-share.prototype.js +9 -12
- package/objects/o-social-list/o-social-list.prototype.js +6 -4
- package/package.json +5 -5
- package/utils/getDataSet.js +24 -0
- package/utils/getSocialPlatforms.js +10 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "email",
|
|
4
|
+
"label": "Email"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"name": "facebook",
|
|
8
|
+
"label": "Facebook"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "facebook-circle",
|
|
12
|
+
"label": "Facebook"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "flipboard",
|
|
16
|
+
"label": "Fliboard"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "instagram",
|
|
20
|
+
"label": "Instagram"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "linkedin",
|
|
24
|
+
"label": "LinkedIn"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "mastodon",
|
|
28
|
+
"label": "Mastodon"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "pinit",
|
|
32
|
+
"label": "Pinterest"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "print",
|
|
36
|
+
"label": "Print"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "reddit",
|
|
40
|
+
"label": "Reddit"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "threads",
|
|
44
|
+
"label": "Threads"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "tiktok",
|
|
48
|
+
"label": "Tiktok"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "tumblr",
|
|
52
|
+
"label": "Tumblr"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "twitch",
|
|
56
|
+
"label": "Twitch"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "twitter",
|
|
60
|
+
"label": "X"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "youtube",
|
|
64
|
+
"label": "YouTube"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
{% if c_icon_url %}
|
|
2
|
-
<a class="{{ c_icon_link_classes }}" href="{{ c_icon_url }}"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<a class="{{ c_icon_link_classes }}" href="{{ c_icon_url }}"
|
|
3
|
+
{% if c_icon_rel_name %}
|
|
4
|
+
rel="{{ c_icon_rel_name }}"
|
|
5
|
+
{% endif %}
|
|
6
|
+
{% if c_icon_target_attr %}
|
|
7
|
+
target="{{ c_icon_target_attr }}"
|
|
8
|
+
{% endif %}
|
|
9
|
+
{% if c_icon_screen_reader_title_attr %}
|
|
10
|
+
title="{{ c_icon_screen_reader_title_attr }}"
|
|
11
|
+
{% endif %}
|
|
12
|
+
>
|
|
13
|
+
|
|
14
|
+
<span class="lrv-a-screen-reader-only" data-label="c_icon_link_screen_reader_text">{{ c_icon_link_screen_reader_text }}</span>
|
|
11
15
|
{% endif %}
|
|
12
16
|
|
|
13
17
|
{% if c_icon_screen_reader_text %}
|
|
14
18
|
{% if c_icon_screen_reader_tag_text %}
|
|
15
|
-
|
|
19
|
+
<{{ c_icon_screen_reader_tag_text }} class="lrv-a-screen-reader-only" data-label="c_icon_screen_reader_text">{{ c_icon_screen_reader_text }}</{{ c_icon_screen_reader_tag_text }}>
|
|
16
20
|
{% else %}
|
|
17
|
-
|
|
21
|
+
<span class="lrv-a-screen-reader-only" data-label="c_icon_screen_reader_text">{{ c_icon_screen_reader_text }}</span>
|
|
18
22
|
{% endif %}
|
|
19
23
|
{% endif %}
|
|
20
24
|
|
|
@@ -30,5 +34,5 @@
|
|
|
30
34
|
</svg>
|
|
31
35
|
|
|
32
36
|
{% if c_icon_url %}
|
|
33
|
-
</a>
|
|
37
|
+
</a>
|
|
34
38
|
{% endif %}
|
|
@@ -32,19 +32,22 @@ c_tagline.c_tagline_text =
|
|
|
32
32
|
|
|
33
33
|
o_social_list.o_social_list_classes += ' lrv-u-flex';
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [ 'instagram', 'twitter', 'facebook', 'youtube' ] );
|
|
36
36
|
const o_social_list_icons = [];
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
socialPlatforms.forEach( ( { name, label } ) => {
|
|
39
39
|
const c_icon = clonedeep( c_icon_prototype );
|
|
40
40
|
|
|
41
|
-
c_icon.c_icon_name =
|
|
41
|
+
c_icon.c_icon_name = name;
|
|
42
42
|
c_icon.c_icon_link_classes +=
|
|
43
43
|
' lrv-u-display-block lrv-u-border-radius-50p lrv-u-padding-a-025 lrv-u-color-grey lrv-u-background-color-white lrv-u-color-grey-dark:hover lrv-u-margin-r-1';
|
|
44
44
|
c_icon.c_icon_url = '#';
|
|
45
|
+
c_icon.c_icon_screen_reader_text = label;
|
|
46
|
+
c_icon.c_icon_screen_reader_title_attr = label;
|
|
45
47
|
|
|
46
48
|
o_social_list_icons.push( c_icon );
|
|
47
|
-
}
|
|
49
|
+
} );
|
|
50
|
+
|
|
48
51
|
o_social_list.o_social_list_icons = o_social_list_icons;
|
|
49
52
|
|
|
50
53
|
module.exports = {
|
|
@@ -47,15 +47,17 @@ c_icon_twitter.c_icon_name = 'twitter';
|
|
|
47
47
|
c_icon_twitter.c_icon_classes =
|
|
48
48
|
'lrv-u-width-16 lrv-u-height-16 lrv-u-color-black';
|
|
49
49
|
c_icon_twitter.c_icon_url = '#';
|
|
50
|
-
c_icon_twitter.
|
|
51
|
-
c_icon_twitter.
|
|
50
|
+
c_icon_twitter.c_icon_link_screen_reader_text = 'X Icon';
|
|
51
|
+
c_icon_twitter.c_icon_screen_reader_text = false;
|
|
52
|
+
c_icon_twitter.c_icon_screen_reader_title_attr = 'X Icon';
|
|
52
53
|
c_icon_twitter.c_icon_link_classes = 'lrv-u-flex';
|
|
53
54
|
|
|
54
55
|
c_icon_mail.c_icon_name = 'envelope';
|
|
55
56
|
c_icon_mail.c_icon_classes =
|
|
56
57
|
'lrv-u-margin-l-075 lrv-u-width-16 lrv-u-height-16 lrv-u-color-black';
|
|
57
58
|
c_icon_mail.c_icon_url = '#';
|
|
58
|
-
c_icon_mail.
|
|
59
|
+
c_icon_mail.c_icon_link_screen_reader_text = 'Email Icon';
|
|
60
|
+
c_icon_mail.c_icon_screen_reader_text = false;
|
|
59
61
|
c_icon_mail.c_icon_screen_reader_title_attr = 'Email Icon';
|
|
60
62
|
c_icon_mail.c_icon_link_classes = 'lrv-u-flex';
|
|
61
63
|
|
|
@@ -21,22 +21,24 @@ c_tagline.c_tagline_classes =
|
|
|
21
21
|
c_tagline.c_tagline_text =
|
|
22
22
|
'Get our latest stories in the feed of your favorite networks';
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const socialPlatforms = require( '../../utils/getSocialPlatforms' )();
|
|
25
25
|
|
|
26
26
|
// Clear existing icons, update classes
|
|
27
27
|
o_social_list.o_social_list_icons = [];
|
|
28
28
|
o_social_list.o_social_list_classes =
|
|
29
29
|
'lrv-a-unstyle-list lrv-u-flex lrv-u-align-items-center lrv-u-justify-content-center';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
socialPlatforms.forEach( ( { name, label } ) => {
|
|
32
32
|
const c_icon = clonedeep( c_icon_prototype );
|
|
33
33
|
c_icon.c_icon_url = '#';
|
|
34
|
-
c_icon.c_icon_name =
|
|
34
|
+
c_icon.c_icon_name = name;
|
|
35
35
|
c_icon.c_icon_link_classes +=
|
|
36
36
|
' lrv-u-display-block lrv-u-border-radius-50p lrv-u-color-grey lrv-u-margin-lr-050 lrv-u-padding-a-050 lrv-u-background-color-white lrv-u-color-grey-dark:hover';
|
|
37
|
+
c_icon.c_icon_screen_reader_text = label;
|
|
38
|
+
c_icon.c_icon_screen_reader_title_attr = label;
|
|
37
39
|
|
|
38
40
|
o_social_list.o_social_list_icons.push( c_icon );
|
|
39
|
-
}
|
|
41
|
+
} );
|
|
40
42
|
|
|
41
43
|
module.exports = {
|
|
42
44
|
footer_social_classes:
|
|
@@ -15,18 +15,22 @@ read_next.c_title.c_title_link_classes =
|
|
|
15
15
|
'lrv-a-unstyle-link lrv-u-whitespace-nowrap lrv-a-font-body-m';
|
|
16
16
|
|
|
17
17
|
const o_social_list = clonedeep( o_social_list_prototype );
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [ 'facebook', 'twitter', 'email' ] );
|
|
20
|
+
|
|
19
21
|
const social_list_icons = [];
|
|
20
22
|
o_social_list.o_social_list_icons = [];
|
|
21
|
-
|
|
23
|
+
socialPlatforms.forEach( ( { name, label } ) => {
|
|
22
24
|
const c_icon = clonedeep( c_icon_prototype );
|
|
23
|
-
c_icon.c_icon_name =
|
|
25
|
+
c_icon.c_icon_name = name;
|
|
24
26
|
c_icon.c_icon_url = '#';
|
|
25
27
|
c_icon.c_icon_link_classes +=
|
|
26
28
|
'lrv-u-background-color-white lrv-u-border-radius-50p lrv-u-color-black lrv-u-color-brand-primary:hover lrv-u-display-block';
|
|
27
29
|
c_icon.c_icon_rel_name = 'noopener noreferrer';
|
|
30
|
+
c_icon.c_icon_screen_reader_text = label;
|
|
31
|
+
c_icon.c_icon_screen_reader_title_attr = label;
|
|
28
32
|
social_list_icons.push( c_icon );
|
|
29
|
-
}
|
|
33
|
+
} );
|
|
30
34
|
o_social_list.o_social_list_icons = social_list_icons;
|
|
31
35
|
|
|
32
36
|
const header_sticky = clonedeep( header_sticky_prototype );
|
|
@@ -3,15 +3,10 @@ const clonedeep = require( 'lodash.clonedeep' );
|
|
|
3
3
|
const c_icon = clonedeep(
|
|
4
4
|
require( '../../components/c-icon/c-icon.prototype' )
|
|
5
5
|
);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'twitter',
|
|
9
|
-
|
|
10
|
-
'tumblr',
|
|
11
|
-
'reddit',
|
|
12
|
-
'linkedin',
|
|
13
|
-
'print',
|
|
14
|
-
];
|
|
6
|
+
|
|
7
|
+
const socialPlatforms = require( '../../utils/getSocialPlatforms' )( [
|
|
8
|
+
'facebook', 'twitter', 'pinit', 'tumblr', 'reddit', 'linkedin', 'print'
|
|
9
|
+
] );
|
|
15
10
|
|
|
16
11
|
const social_share_primary = [];
|
|
17
12
|
const social_share_secondary = [];
|
|
@@ -22,11 +17,13 @@ c_icon_struct.c_icon_link_classes =
|
|
|
22
17
|
c_icon_struct.c_icon_url = '#';
|
|
23
18
|
c_icon_struct.c_icon_classes = 'lrv-u-width-16 lrv-u-height-16';
|
|
24
19
|
|
|
25
|
-
for ( let i = 0; i <
|
|
20
|
+
for ( let i = 0; i < socialPlatforms.length; i++ ) {
|
|
26
21
|
const c_icon_social = clonedeep( c_icon_struct );
|
|
27
22
|
|
|
28
|
-
c_icon_social.c_icon_rel_name =
|
|
29
|
-
c_icon_social.c_icon_name =
|
|
23
|
+
c_icon_social.c_icon_rel_name = socialPlatforms[ i ].name;
|
|
24
|
+
c_icon_social.c_icon_name = socialPlatforms[ i ].name;
|
|
25
|
+
c_icon_social.c_icon_screen_reader_text = socialPlatforms[ i ].label;
|
|
26
|
+
c_icon_social.c_icon_screen_reader_title_attr = socialPlatforms[ i ].label;
|
|
30
27
|
|
|
31
28
|
if ( 3 < i ) {
|
|
32
29
|
social_share_primary.push( c_icon_social );
|
|
@@ -2,20 +2,22 @@ const clonedeep = require( 'lodash.clonedeep' );
|
|
|
2
2
|
|
|
3
3
|
const c_icon_prototype = require( '../../components/c-icon/c-icon.prototype' );
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const socialPlatforms = require( '../../utils/getSocialPlatforms' )();
|
|
6
6
|
const o_social_list_icons = [];
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
socialPlatforms.forEach( ( { name, label } ) => {
|
|
9
9
|
const c_icon = clonedeep( c_icon_prototype );
|
|
10
10
|
|
|
11
11
|
c_icon.c_icon_url = '#';
|
|
12
|
-
c_icon.c_icon_name =
|
|
12
|
+
c_icon.c_icon_name = name;
|
|
13
13
|
c_icon.c_icon_link_classes +=
|
|
14
14
|
' lrv-u-display-block lrv-u-border-radius-50p lrv-u-color-grey lrv-u-margin-lr-050 lrv-u-padding-a-050 lrv-u-background-color-white lrv-u-color-grey-dark:hover';
|
|
15
15
|
c_icon.c_icon_rel_name = 'noopener noreferrer';
|
|
16
|
+
c_icon.c_icon_screen_reader_text = label;
|
|
17
|
+
c_icon.c_icon_screen_reader_title_attr = label;
|
|
16
18
|
|
|
17
19
|
o_social_list_icons.push( c_icon );
|
|
18
|
-
}
|
|
20
|
+
} );
|
|
19
21
|
|
|
20
22
|
module.exports = {
|
|
21
23
|
o_social_list_classes: 'lrv-a-unstyle-list',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penskemediacorp/larva-patterns",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "Larva markup patterns.",
|
|
5
5
|
"author": "laras126 <laras126@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Penske-Media-Corp/pmc-larva/tree/master/packages/patterns#readme",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"url": "https://github.com/Penske-Media-Corp/pmc-larva/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@penskemediacorp/larva-css": "^1.
|
|
24
|
-
"@penskemediacorp/larva-js": "^1.
|
|
25
|
-
"@penskemediacorp/larva-svg": "^1.
|
|
23
|
+
"@penskemediacorp/larva-css": "^1.62.0",
|
|
24
|
+
"@penskemediacorp/larva-js": "^1.62.0",
|
|
25
|
+
"@penskemediacorp/larva-svg": "^1.62.0",
|
|
26
26
|
"lodash.clonedeep": "^4"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "98f814d7a39a0f7ca6e1b2ed4c928e8604a1001f"
|
|
29
29
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to get larva-patterns/_data array by property
|
|
3
|
+
*
|
|
4
|
+
* @param {String} filename JSON filenames in ../_data.
|
|
5
|
+
* @param {String} orderKey Object property name to sort/order by.
|
|
6
|
+
* @param {Array} orderValues Desired items from data file(s) (by orderKey property).
|
|
7
|
+
*/
|
|
8
|
+
module.exports = function( filename, orderKey, orderValues ) {
|
|
9
|
+
const data = require( `../_data/${ filename }.json` );
|
|
10
|
+
|
|
11
|
+
if ( orderKey && orderValues ) {
|
|
12
|
+
const sortedData = [];
|
|
13
|
+
|
|
14
|
+
orderValues.forEach( ( orderValue ) => {
|
|
15
|
+
sortedData.push(
|
|
16
|
+
data.find( ( values ) => values[ orderKey ] === orderValue )
|
|
17
|
+
);
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
return sortedData;
|
|
21
|
+
} else {
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get social platform information
|
|
3
|
+
*
|
|
4
|
+
* @param {Array} platforms "name" property values of desired platforms (see ../_data/social-platforms.json).
|
|
5
|
+
*/
|
|
6
|
+
module.exports = function( platforms ) {
|
|
7
|
+
return require( './getDataSet' )( 'social-platforms', 'name',
|
|
8
|
+
undefined === platforms ? [ 'instagram', 'pinit', 'twitter', 'facebook', 'youtube' ] : platforms
|
|
9
|
+
);
|
|
10
|
+
}
|