Skip to content

Commit

Permalink
feat: named Scripture Feature and ability to show or hide share butto…
Browse files Browse the repository at this point in the history
…n (#2491)
  • Loading branch information
nlewis84 committed Apr 27, 2022
1 parent e0da929 commit 0cd3f86
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions packages/apollos-ui-connected/src/features/ScriptureFeature.js
@@ -1,36 +1,44 @@
import React from 'react';
import PropTypes from 'prop-types';

import { ActionCard, PaddedView } from '@apollosproject/ui-kit';
import { ActionCard, PaddedView, named } from '@apollosproject/ui-kit';
import { ScriptureItem } from '@apollosproject/ui-scripture';
import ShareButtonConnected from '../ShareButtonConnected';

const ScriptureFeature = ({
scriptures,
sharing: { message } = {},
title,
isLoading,
contentId,
nodeId,
featureId,
isCard,
isLoading,
nodeId,
scriptures,
sharing: { message } = {},
showShareButton,
title,
}) => {
const Wrapper = (
{ children } // eslint-disable-line react/prop-types
) =>
// eslint-disable-next-line no-nested-ternary
isCard ? (
<ActionCard
label={title}
icon={'text'}
action={
<ShareButtonConnected
message={message}
itemId={nodeId || contentId || featureId}
/>
}
>
{children}
</ActionCard>
showShareButton ? (
<ActionCard
label={title}
icon={'text'}
action={
<ShareButtonConnected
message={message}
itemId={nodeId || contentId || featureId}
/>
}
>
{children}
</ActionCard>
) : (
<ActionCard label={title} icon={'text'}>
{children}
</ActionCard>
)
) : (
<PaddedView>{children}</PaddedView>
);
Expand All @@ -53,6 +61,7 @@ const ScriptureFeature = ({

ScriptureFeature.defaultProps = {
isCard: true,
showShareButton: true,
};

ScriptureFeature.propTypes = {
Expand All @@ -72,6 +81,7 @@ ScriptureFeature.propTypes = {
title: PropTypes.string,
nodeId: PropTypes.string,
featureId: PropTypes.string,
showShareButton: PropTypes.bool,
};

export default ScriptureFeature;
export default named('ui-connected.ScriptureFeature')(ScriptureFeature);

0 comments on commit 0cd3f86

Please sign in to comment.