Skip to content

Commit

Permalink
Added intro text and quote in home page
Browse files Browse the repository at this point in the history
  • Loading branch information
silversonicaxel committed May 6, 2024
1 parent c05a2d7 commit ca9ab59
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/app.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.uaapp_quote {
margin: 20px 0;
text-align: right;
}

.uaapp_quote q {
font-style: italic;
}

.uaapp_quote footer {
font-size: smaller;
}
18 changes: 17 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import { getRandomQuote } from '../src/api/quote'
import { HeroImage } from '../src/views/hero-image'
import styles from './app.module.css'

export const dynamic = 'force-dynamic'

export default async function AppPage() {
const quote = await getRandomQuote()

export default function RootPage() {
return (
<>
<h1>unknown art</h1>

<p>
unknown art is where you can, hopefully, get in contact with persons,
lovers, thinkers, minds or artists, all over the beautiful world.
</p>

<HeroImage />

<blockquote className={styles.uaapp_quote}>
<q>{quote.message}</q>
<footer>{quote.author}</footer>
</blockquote>
</>
)
}
13 changes: 13 additions & 0 deletions src/api/quote/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Quote } from '../../../src/types/quote'
import clientPromise from '../../config/mongodb'

export const getRandomQuote = async (): Promise<Quote> => {
const mongoClient = await clientPromise
const data = await mongoClient
.db('ua-db')
.collection('ua-quotes')
.aggregate([{ $sample: { size: 1 } }])
.toArray()

return JSON.parse(JSON.stringify(data[0]))
}
4 changes: 4 additions & 0 deletions src/types/quote.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type Quote = {
message: string
author: string
}

0 comments on commit ca9ab59

Please sign in to comment.