Skip to content

Commit

Permalink
feat: enhance UI and adapt to different group colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahim-mamdouh-ft committed Aug 27, 2024
1 parent ae1d742 commit 8c8126b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
3 changes: 2 additions & 1 deletion components/x-gift-article/src/GiftArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ const withGiftFormActions = withActions(
getHighlightPreview() {
return (state) => {
state.highlight = document.querySelector(`.${state.highlightClassName}`)?.textContent
return { highlight: state.highlight }
state.highlightClassName = document.querySelector(`.${state.highlightClassName}`)?.classList.value
return { highlight: state.highlight, highlightClassName: state.highlightClassName }
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions components/x-gift-article/src/IncludeHighlights.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { h } from '@financial-times/x-engine'
import { canShareWithNonSubscribers, isNonSubscriberOption, trimHighlights } from './lib/highlightsHelpers'

export const IncludeHighlights = (props) => {
const { actions, highlight, enterpriseEnabled, includeHighlights } = props
const { actions, highlight, enterpriseEnabled, includeHighlights, highlightClassName } = props
const _canShareWithNonSubscribers = canShareWithNonSubscribers(props)
const _isNonSubscriberOption = isNonSubscriberOption(props)

Expand All @@ -18,7 +18,17 @@ export const IncludeHighlights = (props) => {
role="group"
>
{includeHighlights && (
<p className="shared-article-dialog__include-highlights-quote">{trimHighlights(highlight)}</p>
<div className="shared-article-dialog__include-highlights-quote-wrapper">
<h3 className="share-article-dialog__header">
<span className="share-article-dialog__header-share-article-title">
Highlighted text when shared:
</span>
</h3>

<mark className={`shared-article-dialog__include-highlights-quote ${highlightClassName}`}>
{trimHighlights(highlight)}
</mark>
</div>
)}
<div className="o-forms-input o-forms-input--checkbox o-forms-field">
<label htmlFor="excludeHighlights">
Expand Down
13 changes: 8 additions & 5 deletions components/x-gift-article/src/ShareArticleDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,15 @@
margin-top: oSpacingByName('s6');
}

.shared-article-dialog__include-highlights-quote-wrapper {
margin-bottom: oSpacingByName('s6');
}

.shared-article-dialog__include-highlights-quote {
@include oTypographyDisplay($scale: 0, $weight: 'semibold');
margin-top: 0;
margin-bottom: oSpacingByName('s4');
padding: oSpacingByName('s1') oSpacingByName('s2');
background-color: rgba(255, 236, 26, 0.5);
@include oTypographySans($scale: 0, $include-font-family: 0);
font-family: Georgia, serif;
padding: oSpacingByName('s1') oSpacingByName('s3');
display: block;
}

.share-article-dialog__create-link-button {
Expand Down

0 comments on commit 8c8126b

Please sign in to comment.