mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Implement Highlight SidebarSection
This commit is contained in:
parent
f2b5945f64
commit
2dbc27d4f7
7 changed files with 59 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ export default defineConfig({
|
|||
icon({ iconDir: 'src/img/icons' }),
|
||||
react()
|
||||
],
|
||||
image: { domains: ['cdn.sittingonclouds.net'] },
|
||||
output: 'server',
|
||||
adapter: node({ mode: 'standalone' })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import yt from 'img/socials/yt.png'
|
|||
import twitter from 'img/socials/twitter.png'
|
||||
import SidebarSection from './sidebar/SidebarSection.astro'
|
||||
|
||||
// import Highlight from './sidebar/Highlight.astro'
|
||||
import Highlight from './sidebar/Highlight.astro'
|
||||
|
||||
const listClass =
|
||||
'uppercase text-3xl font-semibold w-full text-center py-3 hover:bg-dark-hover hover:text-cyan-400 hover:underline'
|
||||
|
|
@ -39,6 +39,6 @@ const listClass =
|
|||
</a>
|
||||
</div>
|
||||
</SidebarSection>
|
||||
<!-- <Highlight /> -->
|
||||
<Highlight />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
8
src/components/sidebar/Highlight.astro
Normal file
8
src/components/sidebar/Highlight.astro
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
import Content from './highlight/content.astro'
|
||||
import Loading from './highlight/loading.astro'
|
||||
---
|
||||
|
||||
<Content server:defer>
|
||||
<Loading slot='fallback' />
|
||||
</Content>
|
||||
10
src/components/sidebar/SidebarSection.astro
Normal file
10
src/components/sidebar/SidebarSection.astro
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
interface Props {
|
||||
class?: string
|
||||
}
|
||||
const { class: className } = Astro.props
|
||||
---
|
||||
|
||||
<div class:list={['relative bg-gray rounded-md p-3.5', className]}>
|
||||
<slot />
|
||||
</div>
|
||||
27
src/components/sidebar/highlight/content.astro
Normal file
27
src/components/sidebar/highlight/content.astro
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
import prismaClient from 'utils/prisma-client'
|
||||
|
||||
import AlbumBox from 'components/AlbumBox.astro'
|
||||
import SidebarSection from '../SidebarSection.astro'
|
||||
|
||||
const highlightConfig = await prismaClient.config.findUnique({
|
||||
where: { name: 'highlight' },
|
||||
select: { value: true }
|
||||
})
|
||||
|
||||
const album = highlightConfig?.value
|
||||
? await prismaClient.albums.findUnique({
|
||||
where: { id: parseInt(highlightConfig.value) },
|
||||
select: { title: true, id: true }
|
||||
})
|
||||
: null
|
||||
---
|
||||
|
||||
{
|
||||
album ? (
|
||||
<SidebarSection>
|
||||
<div class='uppercase text-center text-2xl/6 font-semibold'>Highlight Soundtrack</div>
|
||||
<AlbumBox href={`/album/${album.id}`} title={album.title ?? 'Unknown Title'} image={`/album/${album.id}.png`} />
|
||||
</SidebarSection>
|
||||
) : null
|
||||
}
|
||||
9
src/components/sidebar/highlight/loading.astro
Normal file
9
src/components/sidebar/highlight/loading.astro
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
import AlbumBox from 'components/AlbumBox.astro'
|
||||
import SidebarSection from '../SidebarSection.astro'
|
||||
---
|
||||
|
||||
<SidebarSection>
|
||||
<div class='uppercase text-center text-2xl/6 font-semibold'>Highlight Soundtrack</div>
|
||||
<AlbumBox loading />
|
||||
</SidebarSection>
|
||||
|
|
@ -11,7 +11,8 @@ export default {
|
|||
'dark-hover': '#2b3035',
|
||||
gray: '#3f3f3f',
|
||||
'gray-hover': '#4f4f4f',
|
||||
'soc-green': '#4b7667'
|
||||
'soc-green': '#4b7667',
|
||||
'hover-link': '#00d4ff'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue