Skip to content

Commit 664326f

Browse files
Merge pull request #153 from StackOverflowIsBetterThanAnyAI/152-set-max-width-on-whole-page
set max width 2048px for whole page content, replace falsy headings, render main grid based on css
2 parents 831d9dd + ac83453 commit 664326f

File tree

5 files changed

+43
-72
lines changed

5 files changed

+43
-72
lines changed

src/components/UI/navigation/Navigation.tsx

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -342,39 +342,41 @@ const Navigation = () => {
342342
return (
343343
<div className="sticky top-0 z-10" data-testid="navigation-container">
344344
<nav
345-
className={`bg-zinc-925 text-slate-300 flex justify-between py-2 px-4 h-16
346-
transition-opacity duration-500 ease-in-out ${navOpacity}`}
345+
className={`bg-zinc-925 text-slate-300 py-2 px-4 h-16
346+
transition-opacity duration-500 ease-in-out ${navOpacity}`}
347347
data-testid="navigation"
348348
>
349-
<HomeIcon />
350-
{contextScreenWidth === 'TABLET' ||
351-
contextScreenWidth === 'DESKTOP' ? (
352-
<DesktopSearch
353-
handleBlur={handleBlur}
354-
handleChange={handleChange}
355-
handleClick={handleClickCompletion}
356-
handleFocus={handleFocus}
357-
handleInput={handleInput}
358-
handleKeyDown={handleKeyDown}
359-
handleSearch={handleSearch}
360-
handleSearchDoubleClick={handleSearchDoubleClick}
361-
handleSearchKeyDown={handleSearchKeyDown}
362-
inputRef={inputRef}
363-
searchResultsExpanded={searchResultsExpanded}
364-
ref={desktopSearchRef}
365-
/>
366-
) : (
367-
<ButtonIcon
368-
ariaLabel="Search current Livestreams."
369-
ariaPressed={ariaPressed}
370-
buttonIconRef={buttonIconRef}
371-
type="Search"
372-
title="Toggle search bar."
373-
onClick={handleToggleMobile}
374-
place="center"
375-
/>
376-
)}
377-
<UserIcon anchorRef={anchorRef} buttonRef={userIconRef} />
349+
<div className="max-w-[2048px] flex justify-between w-full m-auto">
350+
<HomeIcon />
351+
{contextScreenWidth === 'TABLET' ||
352+
contextScreenWidth === 'DESKTOP' ? (
353+
<DesktopSearch
354+
handleBlur={handleBlur}
355+
handleChange={handleChange}
356+
handleClick={handleClickCompletion}
357+
handleFocus={handleFocus}
358+
handleInput={handleInput}
359+
handleKeyDown={handleKeyDown}
360+
handleSearch={handleSearch}
361+
handleSearchDoubleClick={handleSearchDoubleClick}
362+
handleSearchKeyDown={handleSearchKeyDown}
363+
inputRef={inputRef}
364+
searchResultsExpanded={searchResultsExpanded}
365+
ref={desktopSearchRef}
366+
/>
367+
) : (
368+
<ButtonIcon
369+
ariaLabel="Search current Livestreams."
370+
ariaPressed={ariaPressed}
371+
buttonIconRef={buttonIconRef}
372+
type="Search"
373+
title="Toggle search bar."
374+
onClick={handleToggleMobile}
375+
place="center"
376+
/>
377+
)}
378+
<UserIcon anchorRef={anchorRef} buttonRef={userIconRef} />
379+
</div>
378380
</nav>
379381
{(contextScreenWidth === 'MOBILE' ||
380382
contextScreenWidth === 'TABLET_SMALL') &&

src/components/skeleton/SkeletonFeed.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
import { useContext } from 'react'
21
import SkeletonChannelInfo from './SkeletonChannelInfo'
32
import SkeletonProfilePicture from './SkeletonProfilePicture'
43
import SkeletonThumbnail from './SkeletonThumbnail'
5-
import { ContextScreenWidth } from '../../App'
64

75
const SkeletonFeed = () => {
8-
const contextScreenWidth = useContext(ContextScreenWidth)
9-
if (!contextScreenWidth) {
10-
throw new Error(
11-
'ContextScreenWidth must be used within a ContextScreenWidth.Provider'
12-
)
13-
}
14-
156
const skeletonArray = Array.from({ length: 20 }, (_, i) => i)
167
return (
17-
<>
8+
<div className="max-w-[2048px] mx-auto">
189
<div className="w-full lg:w-4/5 max-w-6xl m-auto pt-4">
1910
<div
2011
className="bg-zinc-50 rounded-full h-6 animate-pulse my-2"
@@ -28,15 +19,7 @@ const SkeletonFeed = () => {
2819
className="bg-zinc-50 rounded-full h-5 animate-pulse my-4 mx-4"
2920
style={{ width: 'min(85vw, 320px)' }}
3021
></div>
31-
<article
32-
className={`p-4 gap-4 ${
33-
contextScreenWidth === 'MOBILE'
34-
? 'grid grid-cols-1'
35-
: contextScreenWidth === 'TABLET_SMALL'
36-
? 'grid grid-cols-2'
37-
: 'grid grid-cols-auto-fill-284'
38-
}`}
39-
>
22+
<article className="p-4 gap-4 grid grid-cols-1 min-[384px]:grid-cols-2 sm:grid-cols-auto-fill-284">
4023
{skeletonArray.map((item) => {
4124
return (
4225
<article key={item} className="max-w-[440px]">
@@ -51,7 +34,7 @@ const SkeletonFeed = () => {
5134
)
5235
})}
5336
</article>
54-
</>
37+
</div>
5538
)
5639
}
5740

src/components/streamFeed/StreamFeed.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
ContextFocusInput,
2121
ContextLanguage,
2222
ContextSEOSearchText,
23-
ContextScreenWidth,
2423
ContextSearchText,
2524
ContextStreamData,
2625
} from '../../App'
@@ -75,13 +74,6 @@ const StreamFeed = () => {
7574
const [filteredStreamData, setFilteredStreamData] =
7675
contextFilteredStreamData
7776

78-
const contextScreenWidth = useContext(ContextScreenWidth)
79-
if (!contextScreenWidth) {
80-
throw new Error(
81-
'ContextScreenWidth must be used within a ContextScreenWidth.Provider'
82-
)
83-
}
84-
8577
const contextSearchText = useContext(ContextSearchText)
8678
if (!contextSearchText) {
8779
throw new Error(
@@ -188,7 +180,7 @@ const StreamFeed = () => {
188180
}
189181

190182
return (
191-
<>
183+
<div className="max-w-[2048px] mx-auto">
192184
{filteredStreamData && filteredStreamData.data.length > 0 ? (
193185
<>
194186
{!seoSearchText && (
@@ -247,13 +239,7 @@ const StreamFeed = () => {
247239
</>
248240
)}
249241
<article
250-
className={`p-4 gap-4 ${
251-
contextScreenWidth === 'MOBILE'
252-
? 'grid grid-cols-1'
253-
: contextScreenWidth === 'TABLET_SMALL'
254-
? 'grid grid-cols-2'
255-
: 'grid grid-cols-auto-fill-284'
256-
}`}
242+
className="p-4 gap-4 grid grid-cols-1 min-[384px]:grid-cols-2 sm:grid-cols-auto-fill-284"
257243
data-testid="streamfeed-container"
258244
>
259245
{filteredStreamData.data.map((item, index) => {
@@ -345,7 +331,7 @@ const StreamFeed = () => {
345331
) : (
346332
<StreamNoResults />
347333
)}
348-
</>
334+
</div>
349335
)
350336
}
351337

src/components/streamFeed/StreamTitle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ type StreamTitleProps = {
77

88
const StreamTitle: FC<StreamTitleProps> = ({ testid, title }) => {
99
return (
10-
<h3
10+
<div
1111
className="text-slate-300 w-full px-1 text-ellipsis whitespace-nowrap overflow-hidden text-base lg:text-lg streamfeed"
1212
title={title}
1313
data-testid={testid}
1414
>
1515
{title}
16-
</h3>
16+
</div>
1717
)
1818
}
1919

src/components/streamFeed/StreamTitleHero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ type StreamTitleHeroProps = {
77

88
const StreamTitleHero: FC<StreamTitleHeroProps> = ({ testid, title }) => {
99
return (
10-
<h3
10+
<div
1111
className="text-slate-300 w-full text-pretty text-base lg:text-lg streamfeed"
1212
title={title}
1313
data-testid={testid}
1414
>
1515
{title}
16-
</h3>
16+
</div>
1717
)
1818
}
1919

0 commit comments

Comments
 (0)