Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(website): add books page #583

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions shared/locales/en/website-books.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"section-2": {
"book-1": {
"author": "Peter Singer",
"authorLink": "https://www.thelifeyoucansave.org/the-book/",
"title": "The Life You Can Save – How to Do Your Part to End World Poverty",
"description": "In The Life You Can Save, Peter Singer makes the convincing argument that giving will make a huge difference in the lives of others without diminishing the quality of our own. This book is an urgent call to action and a hopeful primer on how the power of compassion, mixed with rigorous investigation and careful reasoning, can lift others out of despair.",
"quote": "Singer contends that we need to change our views of what is involved in living an ethical life.",
"publisher": "Free Download",
"publisherLink": "https://www.thelifeyoucansave.org/the-book/",
"year": "2019"
},
"book-2": {
"author": "Jason Hickel",
"authorLink": "https://www.jasonhickel.org/the-divide",
"title": "The Divide – Global Inequality from Conquest to Free Marketsy",
"description": "Since 1960, the income gap between the North and South has roughly tripled in size. Today 4.3 billion people, 60 per cent of the world's population, live on less than $5 per day. The richest eight people now control the same amount of wealth as the poorest half of the world combined.",
"quote": "What is causing this growing divide? We are told that poverty is a natural phenomenon that can be fixed with aid. But in reality it is a political problem: poverty doesn’t just exist, it has been created.",
"publisher": "Bloomsbury Publishing",
"publisherLink": "https://wwnorton.com/books/The-Divide/",
"year": "2018"
},
"book-3": {
"author": "Rutger Bregman",
"authorLink": "https://www.rutgerbregman.com/",
"title": "Utopia For Realists – How We Can Build the Ideal World",
"description": "Utopia for Realists is one of those rare books that takes you by surprise and challenges what you thought was possible. From a Canadian city that once eradicated poverty to Richard Nixon's near implementation of basic income for millions of Americans, Bregman takes us on a journey through history and beyond the usual left-right divides to champion exciting ideas whose time has yet come.",
"quote": "\"A more politically radical Malcolm Gladwell.\" – New York Times",
"publisher": "W. W. Norton & Company Publishing",
"publisherLink": "https://crownpublishing.com/archives/feature/annie-lowrey-author-give-people-money",
"year": "2017"
},
"book-4": {
"author": "Abhijit Banerjee & Esther Duflo",
"authorLink": "http://economics.mit.edu/faculty/eduflo/",
"title": "Good Economics for Hard Times – Better Answers to Our Biggest Problems",
"description": "In this revolutionary book, prize-winning economists Abhijit V. Banerjee and Esther Duflo show how economics, when done right, can help us solve the thorniest social and political problems of our day. From immigration to inequality, slowing growth to accelerating climate change, we have the resources to address the challenges we face but we are so often blinded by ideology.",
"quote": "\"Wonderfully refreshing . . . A must read\" – Thomas Piketty",
"publisher": "Penguin Random House Publishing",
"publisherLink": "https://www.penguin.co.uk/books/305/305539/good-economics-for-hard-times/9780141986197.html",
"year": "2019"
},
"book-5": {
"author": "Phil Teer",
"authorLink": "https://twitter.com/pteer",
"title": "The Coming Age of Imagination",
"description": "Phil Teer draws insights from the creative and entrepreneurial effects of basic income experiments and weaves them into stories of how the Romantic poets invented consumerism; artists regenerated cities like New York, Glasgow and Berlin; and creative geniuses like David Bowie, Bob Dylan, Kurt Vonnegut, Haruki Murakami and many others liberated their creative spirits and transformed their lives.",
"quote": "The Coming Age of Imagination is a creative manifesto for universal basic income. When we no longer have to worry about money, we have the opportunity to be creative on a mass scale. Simply put, basic income changes everything.",
"publisher": "Unbound",
"publisherLink": "https://unbound.com/books/the-coming-age-of-imagination/",
"year": "2020"
},
"book-6": {
"author": "William MacAskill",
"authorLink": "https://www.williammacaskill.com/book",
"title": "Doing Good Better – How Effective Altruism Can Help You Make a Difference",
"description": "Most of us want to make a difference. We donate our time and money to charities and causes we deem worthy, choose careers we consider meaningful, and patronize businesses and buy products we believe make the world a better place. Unfortunately, we often base these decisions on assumptions and emotions rather than facts. As a result, even our best intentions often lead to ineffective—and sometimes downright harmful—outcomes. How can we do better?",
"quote": "\"Even for small givers, a more rational approach to philanthropy can focus attention on areas that make the biggest enduring contribution to human welfare.\" – New York Times",
"publisher": "Penguin Random House Publishing",
"publisherLink": "https://www.penguinrandomhouse.com/books/316786/doing-good-better-by-william-macaskill/",
"year": "2015"
},
"book-7": {
"author": "Amartya Sen",
"authorLink": "https://en.wikipedia.org/wiki/Amartya_Sen",
"title": "Development as Freedom",
"description": "In Development as Freedom Amartya Sen explains how in a world of unprecedented increase in overall opulence millions of people living in the Third World are still unfree. Even if they are not technically slaves, they are denied elementary freedoms and remain imprisoned in one way or another by economic poverty, social deprivation, political tyranny or cultural authoritarianism.",
"quote": "By the winner of the 1988 Nobel Prize in Economics, an essential and paradigm-altering framework for understanding economic development — for both rich and poor — in the twenty-first century.",
"publisher": "Oxford University Press",
"publisherLink": "https://global.oup.com/?cc=ch",
"year": "2001"
},
"book-8": {
"author": "Annie Lowrey",
"authorLink": "https://en.wikipedia.org/wiki/Annie_Lowrey",
"title": "Give People Money",
"description": "In this sparkling and provocative book, economics writer Annie Lowrey examines the UBI movement from many angles. She travels to Kenya to see how a UBI is lifting the poorest people on earth out of destitution, India to see how inefficient government programs are failing the poor, South Korea to interrogate UBI’s intellectual pedigree, and Silicon Valley to meet the tech titans financing UBI pilots in expectation of a world with advanced artificial intelligence and little need for human labor.",
"quote": "\"Like UBI, the book is ambitious, and it presents a strong case for cash aid.\" — Financial Times",
"publisher": "Crown Publishing",
"publisherLink": "https://crownpublishing.com/archives/feature/annie-lowrey-author-give-people-money",
"year": "2018"
},
"book-9": {
"author": "Abhijit V. Banerjee & Esther Duflo",
"authorLink": "https://en.wikipedia.org/wiki/Poor_Economics",
"title": "Poor Economics",
"description": "This eye-opening book overturns the myths about what it is like to live on very little, revealing the unexpected decisions that millions of people make every day. Looking at some of the most paradoxical aspects of life below the poverty line - why the poor need to borrow in order to save, why incentives that seem effective to us may not be for them, and why, despite being more risk-taking than high financiers, they start businesses but rarely grow them.",
"quote": "\"Refreshingly original, wonderfully insightful ... an entirely new perspective\" — Guardian",
"publisher": "Penguin Publishing",
"publisherLink": "https://www.penguin.co.uk/books/186/186390/poor-economics/9780718193669.html",
"year": "2012"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions website/src/app/[lang]/[country]/(website)/books/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { DefaultPageProps } from '@/app/[lang]/[country]';
import Section1 from './section-1';
import Section2 from './section-2';

export default async function Page(props: DefaultPageProps) {
return (
<>
<Section1 {...props} />
<Section2 {...props} />
</>
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions website/src/app/[lang]/[country]/(website)/books/section-1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { DefaultPageProps } from '@/app/[lang]/[country]';
import { BaseContainer, Typography } from '@socialincome/ui';

export default async function Section1({ params }: DefaultPageProps) {
return (
<BaseContainer className="mt-20 flex flex-col content-center justify-center text-center">
<Typography as="div" size="4xl" weight="bold" lineHeight="loose" className="m-3 w-auto pb-4">
Recommended Reading
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put these translations also into the website-books.json file and use the Translator as in section-2.tsx?

</Typography>
<Typography as="p" size="xl" weight="normal" lineHeight="relaxed" className="m-auto w-4/5 px-1 pb-3 sm:w-3/5">
A suggested reading list to provide a foundation for understanding Social Income, Basic Income, financial aid,
and poverty.
</Typography>
<Typography as="p" size="xl" weight="normal" lineHeight="relaxed" className="m-auto w-4/5 pb-3 sm:w-3/5">
If you have any additional book recommendations, don't hesitate to <br />
<a href="mailto: [email protected]" className="text-blue-500 hover:text-blue-700">
let us know
</a>
.
</Typography>
<div className=" flex justify-center text-center align-middle ">
<svg xmlns="http://www.w3.org/2000/svg" height="0.8em" viewBox="0 0 512 512">
<path d="M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" />
</svg>
<span className="px-2 text-xs text-zinc-400">Last Update: Oct 8, 2023</span>
</div>
</BaseContainer>
);
}
127 changes: 127 additions & 0 deletions website/src/app/[lang]/[country]/(website)/books/section-2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { DefaultPageProps } from '@/app/[lang]/[country]';
import Book from '@/components/book/book';
import { Translator } from '@socialincome/shared/src/utils/i18n';
import { BaseContainer } from '@socialincome/ui';
import book6cover from './better.jpg';
import book5cover from './coming.jpg';
import book2cover from './divide.jpg';
import book7cover from './freedom.jpg';
import book4cover from './hard.jpg';
import book1cover from './life.jpg';
import book8cover from './lowrey.jpg';
import book9cover from './poor-economics.jpg';
import book3cover from './utopia.jpg';

export default async function Section2({ params }: DefaultPageProps) {
const translator = await Translator.getInstance({
language: params.lang,
namespaces: ['website-books'],
});

return (
<BaseContainer>
<div className="flex w-full flex-col-reverse items-center sm:items-start">
<Book
cover={book1cover}
author={translator.t('section-2.book-1.author')}
authorLink={translator.t('section-2.book-1.authorLink')}
title={translator.t('section-2.book-1.title')}
description={translator.t('section-2.book-1.description')}
quote={translator.t('section-2.book-1.quote')}
publisher={translator.t('section-2.book-1.publisher')}
publisherLink={translator.t('section-2.book-1.publisherLink')}
year={translator.t('section-2.book-1.year')}
/>
<Book
cover={book2cover}
author={translator.t('section-2.book-2.author')}
authorLink={translator.t('section-2.book-2.authorLink')}
title={translator.t('section-2.book-2.title')}
description={translator.t('section-2.book-2.description')}
quote={translator.t('section-2.book-2.quote')}
publisher={translator.t('section-2.book-2.publisher')}
publisherLink={translator.t('section-2.book-2.publisherLink')}
year={translator.t('section-2.book-2.year')}
/>
<Book
cover={book3cover}
author={translator.t('section-2.book-3.author')}
authorLink={translator.t('section-2.book-3.authorLink')}
title={translator.t('section-2.book-3.title')}
description={translator.t('section-2.book-3.description')}
quote={translator.t('section-2.book-3.quote')}
publisher={translator.t('section-2.book-3.publisher')}
publisherLink={translator.t('section-2.book-3.publisherLink')}
year={translator.t('section-2.book-3.year')}
/>
<Book
cover={book4cover}
author={translator.t('section-2.book-4.author')}
authorLink={translator.t('section-2.book-4.authorLink')}
title={translator.t('section-2.book-4.title')}
description={translator.t('section-2.book-4.description')}
quote={translator.t('section-2.book-4.quote')}
publisher={translator.t('section-2.book-4.publisher')}
publisherLink={translator.t('section-2.book-4.publisherLink')}
year={translator.t('section-2.book-4.year')}
/>
<Book
cover={book5cover}
author={translator.t('section-2.book-5.author')}
authorLink={translator.t('section-2.book-5.authorLink')}
title={translator.t('section-2.book-5.title')}
description={translator.t('section-2.book-5.description')}
quote={translator.t('section-2.book-5.quote')}
publisher={translator.t('section-2.book-5.publisher')}
publisherLink={translator.t('section-2.book-5.publisherLink')}
year={translator.t('section-2.book-5.year')}
/>
<Book
cover={book6cover}
author={translator.t('section-2.book-6.author')}
authorLink={translator.t('section-2.book-6.authorLink')}
title={translator.t('section-2.book-6.title')}
description={translator.t('section-2.book-6.description')}
quote={translator.t('section-2.book-6.quote')}
publisher={translator.t('section-2.book-6.publisher')}
publisherLink={translator.t('section-2.book-6.publisherLink')}
year={translator.t('section-2.book-6.year')}
/>
<Book
cover={book7cover}
author={translator.t('section-2.book-7.author')}
authorLink={translator.t('section-2.book-7.authorLink')}
title={translator.t('section-2.book-7.title')}
description={translator.t('section-2.book-7.description')}
quote={translator.t('section-2.book-7.quote')}
publisher={translator.t('section-2.book-7.publisher')}
publisherLink={translator.t('section-2.book-7.publisherLink')}
year={translator.t('section-2.book-7.year')}
/>
<Book
cover={book8cover}
author={translator.t('section-2.book-8.author')}
authorLink={translator.t('section-2.book-8.authorLink')}
title={translator.t('section-2.book-8.title')}
description={translator.t('section-2.book-8.description')}
quote={translator.t('section-2.book-8.quote')}
publisher={translator.t('section-2.book-8.publisher')}
publisherLink={translator.t('section-2.book-8.publisherLink')}
year={translator.t('section-2.book-8.year')}
/>
<Book
cover={book9cover}
author={translator.t('section-2.book-9.author')}
authorLink={translator.t('section-2.book-9.authorLink')}
title={translator.t('section-2.book-9.title')}
description={translator.t('section-2.book-9.description')}
quote={translator.t('section-2.book-9.quote')}
publisher={translator.t('section-2.book-9.publisher')}
publisherLink={translator.t('section-2.book-9.publisherLink')}
year={translator.t('section-2.book-9.year')}
currentlyReading={true}
/>
</div>
</BaseContainer>
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions website/src/components/book/book.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { BaseContainer, Typography } from '@socialincome/ui';
import Image, { StaticImageData } from 'next/image';

type BookProps = {
cover: StaticImageData;
author: string;
authorLink: string;
title: string;
description: string;
quote: string;
publisher: string;
publisherLink: string;
year: string;
currentlyReading?: boolean;
};

export default async function Book({
cover,
author,
authorLink,
title,
description,
quote,
publisher,
publisherLink,
year,
currentlyReading,
}: BookProps) {
let baseClass = currentlyReading
? 'flex flex-nowrap flex-col sm:flex-row pb-5 h-fit shadow-md my-40'
: 'flex flex-nowrap flex-col sm:flex-row pb-5 h-fit shadow-md my-8 ';

return (
<BaseContainer>
<div className={baseClass}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the classNames() function here, e.g.:

className={classNames('flex h-fit flex-col flex-nowrap pb-5 shadow-md sm:flex-row', {
	'my-40': currentlyReading,
		'my-8': !currentlyReading,
})}

<div className="w-fit basis-1/3">
<Image src={cover} height={4000} alt="book cover" />
</div>
<div className="mx-8 flex w-fit basis-5/12 flex-col">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use basis-5/12 here and not basis-2/3 when you use basis-1/3 above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I took that decision looking at how the previous website was made and basis-2/3 might have been a bit too wide.

<div className="flex flex-col items-baseline sm:flex-row">
<Typography as="div" className="mt-6 text-blue-500 sm:mb-2">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as="div" is not needed. You can generally remove the parameter where you use it in this file.

{author}
</Typography>
{currentlyReading ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of using ? here, you can do it with a && operator, which is a little cleaner:

{currentlyReading && (
	<Typography
		as="span"
	size="xs"
	weight="bold"
	className="my-1 rounded-md bg-blue-500 px-2 py-0.5 text-white sm:mx-1"
		>
		Currently reading
	</Typography>
)}

<Typography
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the Typography component here, you could use the Badge component from the ui. See: https://ui.shadcn.com/docs/components/badge

as="span"
size="xs"
weight="bold"
className="my-1 rounded-md bg-blue-500 px-2 py-0.5 text-white sm:mx-1"
>
Currently reading
</Typography>
) : (
<></>
)}
</div>
<Typography as="div" weight="bold" size="xl" lineHeight="relaxed" className="mb-1">
<a href={authorLink}>{title}</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the Link component from Next here. Also, wrap the Typography inside the Link component.

</Typography>
<Typography as="p">{description}</Typography>
<Typography as="p" className="my-5">
{quote}
</Typography>
<Typography as="div" weight="bold">
<a href={publisherLink} className="hover:text-blue-800">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: use the Link component and wrap the Typography inside the Link component.

{publisher}
</a>
</Typography>
<Typography as="div" size="sm">
Published {year}
</Typography>
</div>
</div>
</BaseContainer>
);
}