Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
feature(TrysilPlug): Add support for custom DOM attributes (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumler authored Oct 17, 2018
1 parent 6c82ef7 commit 21ff52d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/molecules/TrysilPlug.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ const TrysilPlug = ({
headingProps,
placeholderUrl,
column,
attributes,
}) => {
const ArticleComponent = column ? ArticleCol : Article;
return (
<ArticleComponent {...column}>
<ArticleComponent {...column} {...attributes}>
<PlugLink href={url}>
{kicker && <Kicker>{kicker}</Kicker>}
{image
Expand Down Expand Up @@ -97,6 +98,8 @@ const TrysilPlug = ({
};

TrysilPlug.propTypes = {
/** Extra attributes you want on the DOM-node. e.g. data-cxense_Tag */
attributes: PropTypes.object, // eslint-disable-line
/** Text above the image plug. */
kicker: PropTypes.string,
/** Main link text. */
Expand Down Expand Up @@ -150,6 +153,7 @@ TrysilPlug.propTypes = {
preventBlur: PropTypes.bool,
};
TrysilPlug.defaultProps = {
attributes: {},
column: null,
kicker: '',
title: '',
Expand Down
3 changes: 3 additions & 0 deletions stories/TrysilPlug/basic-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const TrysilPlugStory = () => (
url="https://example.com"
image="https://2.dbstatic.no/68712816.jpg?imageId=68712816&x=4.7222222222222&y=28.976572133169&cropw=90.740740740741&croph=60.419235511714&width=980&height=490&compression=70"
ratio={0.5}
attributes={{
'data-cxense_Tag': 'cerebro',
}}
labels={[
{
text: 'Meninger',
Expand Down

0 comments on commit 21ff52d

Please sign in to comment.