Add Christmas theme and quotes for December
Introduces a Christmas-themed UI to the homepage during December, including festive colors and a holiday footer message. Adds a collection of Christmas quotes and updates quote selection logic to use them in December, with new utility functions for date checks and quote retrieval.
This commit is contained in:
@@ -3,6 +3,39 @@ export interface Quote {
|
||||
author: string;
|
||||
}
|
||||
|
||||
export const christmasQuotes: Quote[] = [
|
||||
{ text: 'Christmas waves a magic wand over this world, and behold, everything is softer and more beautiful.', author: 'Norman Vincent Peale' },
|
||||
{ text: 'The best way to spread Christmas cheer is singing loud for all to hear.', author: 'Buddy the Elf' },
|
||||
{ text: 'Christmas is not a time nor a season, but a state of mind. To cherish peace and goodwill, to be plenteous in mercy, is to have the real spirit of Christmas.', author: 'Calvin Coolidge' },
|
||||
{ text: 'I will honor Christmas in my heart, and try to keep it all the year.', author: 'Charles Dickens' },
|
||||
{ text: 'Christmas is doing a little something extra for someone.', author: 'Charles M. Schulz' },
|
||||
{ text: 'The magic of Christmas is not in the presents, but in His presence.', author: 'Anonymous' },
|
||||
{ text: 'Christmas is the season of joy, of gift-giving, and of families united.', author: 'Norman Vincent Peale' },
|
||||
{ text: 'Peace on earth will come to stay, when we live Christmas every day.', author: 'Helen Steiner Rice' },
|
||||
{ text: 'Christmas is most truly Christmas when we celebrate it by giving the light of love to those who need it most.', author: 'Ruth Carter Stapleton' },
|
||||
{ text: 'The best of all gifts around any Christmas tree: the presence of a happy family all wrapped up in each other.', author: 'Burton Hillis' },
|
||||
{ text: 'Christmas is a season not only of rejoicing but of reflection.', author: 'Winston Churchill' },
|
||||
{ text: 'Christmas is the day that holds all time together.', author: 'Alexander Smith' },
|
||||
{ text: 'Gifts of time and love are surely the basic ingredients of a truly merry Christmas.', author: 'Peg Bracken' },
|
||||
{ text: 'Christmas, my child, is love in action.', author: 'Dale Evans' },
|
||||
{ text: 'Christmas is the spirit of giving without a thought of getting.', author: 'Thomas S. Monson' },
|
||||
{ text: 'The joy of brightening other lives, bearing each others\' burdens, easing other\'s loads and supplanting empty hearts and lives with generous gifts becomes for us the magic of Christmas.', author: 'W. C. Jones' },
|
||||
{ text: 'Christmas is a time when you get homesick - even when you\'re home.', author: 'Carol Nelson' },
|
||||
{ text: 'Christmas is the season for kindling the fire of hospitality in the hall, the genial flame of charity in the heart.', author: 'Washington Irving' },
|
||||
{ text: 'A lovely thing about Christmas is that it\'s compulsory, like a thunderstorm, and we all go through it together.', author: 'Garrison Keillor' },
|
||||
{ text: 'Christmas is the day that holds all time together.', author: 'Alexander Smith' },
|
||||
{ text: 'The best Christmas trees come very close to exceeding nature.', author: 'Andy Rooney' },
|
||||
{ text: 'Christmas is not as much about opening our presents as opening our hearts.', author: 'Janice Maeditere' },
|
||||
{ text: 'Christmas is doing a little something extra for someone.', author: 'Charles M. Schulz' },
|
||||
{ text: 'At Christmas, all roads lead home.', author: 'Marjorie Holmes' },
|
||||
{ text: 'Christmas is the season of joy, of gift-giving, and of families united.', author: 'Norman Vincent Peale' },
|
||||
{ text: 'Christmas is the spirit of giving without a thought of getting.', author: 'Thomas S. Monson' },
|
||||
{ text: 'May you have the gladness of Christmas which is hope; The spirit of Christmas which is peace; The heart of Christmas which is love.', author: 'Ada V. Hendricks' },
|
||||
{ text: 'Christmas is a time when everybody wants his past forgotten and his present remembered.', author: 'Phyllis Diller' },
|
||||
{ text: 'The best way to spread Christmas cheer is singing loud for all to hear.', author: 'Buddy the Elf' },
|
||||
{ text: 'Christmas waves a magic wand over this world, and behold, everything is softer and more beautiful.', author: 'Norman Vincent Peale' },
|
||||
];
|
||||
|
||||
export const businessQuotes: Quote[] = [
|
||||
{ text: 'Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work.', author: 'Steve Jobs' },
|
||||
{ text: 'Innovation distinguishes between a leader and a follower.', author: 'Steve Jobs' },
|
||||
@@ -110,9 +143,21 @@ export const quotes = businessQuotes;
|
||||
export default businessQuotes;
|
||||
|
||||
/**
|
||||
* Returns a random business quote from the collection
|
||||
* Check if the current date is in December
|
||||
*/
|
||||
function isDecember(): boolean {
|
||||
const now = new Date();
|
||||
return now.getMonth() === 11; // December is month 11 (0-indexed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random quote - Christmas quotes during December, business quotes otherwise
|
||||
*/
|
||||
export function getRandomQuote(): Quote {
|
||||
if (isDecember()) {
|
||||
const randomIndex = Math.floor(Math.random() * christmasQuotes.length);
|
||||
return christmasQuotes[randomIndex];
|
||||
}
|
||||
const randomIndex = Math.floor(Math.random() * businessQuotes.length);
|
||||
return businessQuotes[randomIndex];
|
||||
}
|
||||
@@ -122,7 +167,8 @@ export function getRandomQuote(): Quote {
|
||||
* otherwise returns a random quote from any author
|
||||
*/
|
||||
export function getRandomQuoteByAuthor(author: string): Quote {
|
||||
const authorQuotes = businessQuotes.filter(quote =>
|
||||
const quotesToSearch = isDecember() ? christmasQuotes : businessQuotes;
|
||||
const authorQuotes = quotesToSearch.filter(quote =>
|
||||
quote.author.toLowerCase() === author.toLowerCase()
|
||||
);
|
||||
if (authorQuotes.length === 0) return getRandomQuote();
|
||||
@@ -134,7 +180,15 @@ export function getRandomQuoteByAuthor(author: string): Quote {
|
||||
* Returns quotes filtered by a theme or keyword in the text
|
||||
*/
|
||||
export function getQuotesByTheme(keyword: string): Quote[] {
|
||||
return businessQuotes.filter(quote =>
|
||||
const quotesToSearch = isDecember() ? christmasQuotes : businessQuotes;
|
||||
return quotesToSearch.filter(quote =>
|
||||
quote.text.toLowerCase().includes(keyword.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all available quotes (Christmas quotes in December, business quotes otherwise)
|
||||
*/
|
||||
export function getAllQuotes(): Quote[] {
|
||||
return isDecember() ? christmasQuotes : businessQuotes;
|
||||
}
|
||||
Reference in New Issue
Block a user