From 2881835deea126d722dbc0063efd01d3691c8134 Mon Sep 17 00:00:00 2001
From: Michal Vanko
Date: Tue, 19 Apr 2022 21:15:17 +0200
Subject: [PATCH] Add twitch tv banner to the index page
---
src/lib/styles/sprinkles.css.ts | 2 ++
src/lib/styles/vars.css.ts | 5 +++
src/routes/index.css.ts | 64 +++++++++++++++++++++++++++++++++
src/routes/index.svelte | 37 +++++++++++++++++++
src/routes/layout.css.ts | 9 +++--
5 files changed, 114 insertions(+), 3 deletions(-)
diff --git a/src/lib/styles/sprinkles.css.ts b/src/lib/styles/sprinkles.css.ts
index 063726d..0cefe56 100644
--- a/src/lib/styles/sprinkles.css.ts
+++ b/src/lib/styles/sprinkles.css.ts
@@ -33,6 +33,7 @@ const responsiveProperties = defineProperties({
],
alignItems: ['stretch', 'flex-start', 'center', 'flex-end'],
flex: ['1'],
+ gap: vars.space,
textAlign: ['center', 'justify', 'start', 'end'],
textShadow: vars.textShadow,
paddingTop: vars.space,
@@ -55,6 +56,7 @@ const responsiveProperties = defineProperties({
height: vars.height,
listStyle: ['none'],
overflow: ['auto'],
+ aspectRatio: vars.aspectRatio,
},
shorthands: {
padding: ['paddingTop', 'paddingBottom', 'paddingLeft', 'paddingRight'],
diff --git a/src/lib/styles/vars.css.ts b/src/lib/styles/vars.css.ts
index 6dcf54a..4390eab 100644
--- a/src/lib/styles/vars.css.ts
+++ b/src/lib/styles/vars.css.ts
@@ -19,6 +19,7 @@ export const colors = {
}
export const menuBackground = transparentize(0.6, colors.tearkiss)
+export const twitchEmbedBackground = transparentize(0.6, colors.pinky)
export const background = tint(0.7, colors.lightCyan)
export const codeBackground = tint(0.2, background)
export const quoteBackground = darken(0.02, background)
@@ -130,6 +131,7 @@ export const vars = createGlobalTheme(':root', {
)}`,
},
width: {
+ auto: 'auto',
s: '400px',
m: '700px',
image: '800px',
@@ -146,4 +148,7 @@ export const vars = createGlobalTheme(':root', {
parent: '100%',
image: '640px',
},
+ aspectRatio: {
+ monitor: '16 / 9',
+ },
})
diff --git a/src/routes/index.css.ts b/src/routes/index.css.ts
index 430e37d..c55b050 100644
--- a/src/routes/index.css.ts
+++ b/src/routes/index.css.ts
@@ -1,4 +1,12 @@
import { sprinkles } from '$lib/styles/sprinkles.css'
+import {
+ transparent,
+ twitchEmbedBackground,
+ mediaAt,
+ breakpoints,
+} from '$lib/styles/vars.css'
+import { style } from '@vanilla-extract/css'
+import { radialGradient, transparentize } from 'polished'
export const profilePicClass = sprinkles({
textAlign: 'center',
@@ -21,3 +29,59 @@ export const welcomeNoteClass = sprinkles({
export const citeOwnerClass = sprinkles({
whiteSpace: 'nowrap',
})
+
+export const twitchStreamPromoClass = style([
+ radialGradient({
+ colorStops: [
+ `${twitchEmbedBackground} 0%`,
+ `${transparentize(1, twitchEmbedBackground)} 60%`,
+ ],
+ extent: '90% 40% at 50% 70%',
+ fallback: transparent,
+ }),
+ {
+ '@media': {
+ [mediaAt(breakpoints.l)]: radialGradient({
+ colorStops: [
+ `${twitchEmbedBackground} 0%`,
+ `${transparentize(1, twitchEmbedBackground)} 100%`,
+ ],
+ extent: '180% 50% at 100% 50%',
+ fallback: transparent,
+ }),
+ },
+ },
+])
+
+export const twitchIframeClass = sprinkles({
+ flexGrow: 1,
+ maxWidth: 'image',
+ aspectRatio: 'monitor',
+ width: {
+ mobile: 'parent',
+ desktop: 'auto',
+ },
+})
+
+export const twitchEmbedClass = sprinkles({
+ display: 'flex',
+ padding: '3x',
+ justifyContent: 'center',
+ alignItems: 'center',
+ flexDirection: {
+ mobile: 'column',
+ desktop: 'row',
+ },
+ gap: '4x',
+ width: {
+ mobile: 'parent',
+ desktop: 'auto',
+ },
+})
+
+export const twitchAsideClass = sprinkles({
+ width: {
+ mobile: 'parent',
+ desktop: 's',
+ },
+})
diff --git a/src/routes/index.svelte b/src/routes/index.svelte
index 45c9b41..645de30 100644
--- a/src/routes/index.svelte
+++ b/src/routes/index.svelte
@@ -4,6 +4,10 @@
citeOwnerClass,
mottoClass,
profilePicClass,
+ twitchAsideClass,
+ twitchEmbedClass,
+ twitchIframeClass,
+ twitchStreamPromoClass,
welcomeNoteClass,
} from './index.css'
@@ -47,3 +51,36 @@
. I'll try to share some stories and opinions about things that I'm interested
in.
+
+
diff --git a/src/routes/layout.css.ts b/src/routes/layout.css.ts
index 60e5caf..381fccf 100644
--- a/src/routes/layout.css.ts
+++ b/src/routes/layout.css.ts
@@ -14,7 +14,10 @@ export const appContentClass = style([
export const mainContentClass = sprinkles({
position: 'relative',
- padding: '3x',
+ padding: {
+ mobile: '3x',
+ desktop: 'none',
+ },
})
// Layout global styles
@@ -24,7 +27,7 @@ export const mainContentClass = sprinkles({
// TODO Create atomic classes for maxWidhts and use them everywhere in the content
globalStyle(
- `${mainContentClass} h1, ${mainContentClass} h2, ${mainContentClass} h3, ${mainContentClass} h4, ${mainContentClass} h5, ${mainContentClass} h6, ${mainContentClass} p, ${mainContentClass} ul, ${mainContentClass} ol, ${mainContentClass} figure, ${mainContentClass} img, ${mainContentClass} blockquote, ${mainContentClass} iframe, ${mainContentClass} footer`,
+ `${mainContentClass} h1, ${mainContentClass} h2, ${mainContentClass} h3, ${mainContentClass} h4, ${mainContentClass} h5, ${mainContentClass} h6, ${mainContentClass} p, ${mainContentClass} ul, ${mainContentClass} ol, ${mainContentClass} figure, ${mainContentClass} img, ${mainContentClass} blockquote, ${mainContentClass} iframe:not(.embed), ${mainContentClass} footer`,
{
maxWidth: vars.width.layoutMax,
marginLeft: 'auto',
@@ -40,7 +43,7 @@ globalStyle(`${mainContentClass} h2`, {
maxWidth: vars.width.additionalBlockMax,
})
-globalStyle(`${mainContentClass} iframe`, {
+globalStyle(`${mainContentClass} iframe:not(.embed)`, {
maxWidth: vars.width.additionalBlockMax,
display: 'block',
})