Skip to content

Commit 3d8a1ad

Browse files
committed
Include pullquote in blog articles
[CORE-844]
1 parent d73c145 commit 3d8a1ad

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

src/app/pages/blog/article/article.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ function VideoArticle({data}: {data: ArticleData}) {
158158
}
159159

160160
function normalUnits(unit: UnitType) {
161-
return typeof unit.value === 'string' || ('alignment' in unit.value && unit.value.alignment !== 'bottom');
161+
return !bottomUnits(unit);
162162
}
163163
function bottomUnits(unit: UnitType) {
164-
return typeof unit.value !== 'string' && ('alignment' in unit.value && unit.value.alignment === 'bottom');
164+
return (
165+
typeof unit.value === 'object' &&
166+
'alignment' in unit.value &&
167+
unit.value.alignment === 'bottom'
168+
);
165169
}
166170

167171
function ArticleBody({

test/src/data/article-page-data.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Blog article data as returned by usePageData
2-
/* eslint-disable max-len */
2+
/* eslint-disable max-len, camelcase */
33
export default {
44
id: 754,
55
meta: {
@@ -100,6 +100,25 @@ export default {
100100
value: '<p data-block-key="eg7ck">This publication covers hard and soft skills that are applicable to a broad range of academic majors and fields. The introduction of “Workplace Software and Skills” underscores OpenStax’s commitment to its mission of expanding access to high-quality educational materials for all learners — this book, in particular, is likely to be valuable for learners both within and without traditional academic environments. </p><p data-block-key="c5o15">Since the publication of its first textbook in 2012, OpenStax has rapidly expanded its list of textbooks and technology offerings, and its minimalist book covers have become a familiar sight on campuses across the country. OpenStax resources have been used by 70% of colleges and universities across the United States and over 6,300 K-12 schools and districts.</p><p data-block-key="34gqf">To read the full press release, please <a href="https://news.rice.edu/news/2023/newest-openstax-textbook-provides-essential-workplace-skills-students">click here</a>.</p>',
101101
id: '7c6ae377-18d5-4223-883b-a5e304dd084c'
102102
},
103+
{
104+
type: 'pullquote',
105+
value: {
106+
quote: 'Thank you for the OpenStax materials. I look forward to using them to raise the standards in math and science around the world.',
107+
attribution: 'Amos Tarfa'
108+
},
109+
id: '28d9b0f2-6106-4487-a783-b470916e9517'
110+
},
111+
{
112+
id: 'meh',
113+
type: 'blog_cta',
114+
value: {
115+
alignment: 'left',
116+
heading: 'Heading',
117+
description: 'description text',
118+
button_href: '#',
119+
button_text: 'click me'
120+
}
121+
},
103122
{
104123
type: 'aligned_html',
105124
value: '<a class="btn primary" href="https://openstax.org/details/books/workplace-software-skills"\r\nstyle="background-color:#d4450c;box-shadow:0 2px 4px rgb(0 0 0 / 20%);border-radius:0.5rem;padding:0 3rem;user-select:none;height:5rem;display:inline-flex;align-items:center;"\r\n>Access the textbook now!</a>',

test/src/pages/blog/article.test.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ describe('blog/article', () => {
3333

3434
expect(onload).toHaveBeenCalled();
3535
screen.getByText('2 min read');
36+
expect(document.body.querySelector('.quote-bucket .quote .attribution')).toBeTruthy();
37+
// Bottom-aligned stuff comes at the end
38+
expect(document.body.querySelector('.quote-bucket ~ figure.bottom')).toBeTruthy();
39+
// CTA should be there
40+
screen.getByRole('link', {name: 'click me'});
3641
});
3742
it('handles no data', () => {
3843
mockUsePageData.mockReturnValue(undefined);

0 commit comments

Comments
 (0)