Skip to content

Commit

Permalink
feat: support different banners
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Sep 19, 2023
1 parent 1bc65aa commit 83ac6f6
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 57 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typescript.preferences.importModuleSpecifier": "relative",
"prettier.configPath": ".prettierrc.js",
"cSpell.words": [
"adfit",
"clsx",
"formatjs",
"hyochan",
Expand Down
11 changes: 9 additions & 2 deletions app/[lang]/(common)/AdFitResponsive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import AdFit from './AdFit';
import {useEffect, useState} from 'react';

export default function AdFitResponsive({
units,
className,
adfitClassName,
}: {
className?: string;
units: {
mobile: string;
pc: string;
}
adfitClassName: string,
}): JSX.Element {
const isMobile = useMediaQuery('(max-width: 768px)');
const [loaded, setLoaded] = useState(false);
Expand Down Expand Up @@ -36,7 +43,7 @@ export default function AdFitResponsive({
unit="DAN-SEcRVdSHkh05H0jO"
height={90}
width={728}
className="adfit-top-mobile"
className={adfitClassName}
style={{
flex: 1,
}}
Expand All @@ -49,7 +56,7 @@ export default function AdFitResponsive({
unit="DAN-dAqcoLWvKpYEtbtq"
height={100}
width={320}
className="adfit-top-mobile"
className={`${adfitClassName}-mobile`}
style={{
flex: 1,
}}
Expand Down
13 changes: 10 additions & 3 deletions app/[lang]/(home)/Hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TextInput from '../../(common)/TextInput';

import StatsSymbols from './StatsSymbol';
import StatsUrlCard from './StatsUrlCards';
import { useMediaQuery } from 'usehooks-ts';
import {useMediaQuery} from 'usehooks-ts';
import AdFit from '../../(common)/AdFit';
import AdFitResponsive from '../../(common)/AdFitResponsive';

Expand Down Expand Up @@ -59,7 +59,7 @@ function Hero({t, statsInfo}: Props): ReactElement {
},
];

const isMobile = useMediaQuery('(max-width: 768px)')
const isMobile = useMediaQuery('(max-width: 768px)');
const [selectedPluginType, setSelectedPluginType] = useState(statTypes[0]);
const [login, setLogin] = useState('');
const [searchLogin, setSearchedUID] = useState('');
Expand Down Expand Up @@ -116,7 +116,14 @@ function Hero({t, statsInfo}: Props): ReactElement {
{t.developerPowerMeterDesc}
</p>
{/* Begin: AdFit */}
<AdFitResponsive className='mb-6'/>
<AdFitResponsive
className="mb-6"
adfitClassName="adfit-top"
units={{
mobile: 'DAN-dAqcoLWvKpYEtbtq',
pc: 'DAN-SEcRVdSHkh05H0jO',
}}
/>
{/* End: AdFit */}
{/* Begin: Search Form */}
<form
Expand Down
40 changes: 10 additions & 30 deletions app/[lang]/(home)/SectionFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import type {Translates} from '../../../src/localization';

import imgBgSection1 from '@/public/assets/bg_section1.png';
import SvgScouter from '@/public/assets/scouter.svg';
import { useMediaQuery } from 'usehooks-ts';
import {useMediaQuery} from 'usehooks-ts';
import AdFit from '../(common)/AdFit';
import AdFitResponsive from '../(common)/AdFitResponsive';

const inter = Inter({subsets: ['latin']});

Expand All @@ -16,7 +17,7 @@ type Props = {
};

export default function SectionFooter({t}: Props): ReactElement {
const isMobile = useMediaQuery('(max-width: 768px)')
const isMobile = useMediaQuery('(max-width: 768px)');

return (
<div
Expand Down Expand Up @@ -74,34 +75,13 @@ export default function SectionFooter({t}: Props): ReactElement {
</div>
</div>
{/* Begin: AdFit */}
{!isMobile ? (
<div>
<AdFit
unit="DAN-SEcRVdSHkh05H0jO"
height={90}
width={728}
className="adfit-bottom"
style={{
flex: 1,
marginBottom: 80,
}}
/>
</div>
) : null}
{isMobile ? (
<div>
<AdFit
unit="DAN-dAqcoLWvKpYEtbtq"
height={100}
width={320}
className="adfit-bottom-mobile"
style={{
flex: 1,
marginBottom: 80,
}}
/>
</div>
) : null}
<AdFitResponsive
adfitClassName="adfit-bottom"
units={{
mobile: 'DAN-GfeJUqhlQ5KqCOzw',
pc: 'DAN-9eecqcxVgP9XX0bN',
}}
/>
{/* End: AdFit */}
</div>
);
Expand Down
14 changes: 11 additions & 3 deletions app/[lang]/recent-list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ export default async function Page({

return (
<div className={clsx('flex-1 bg-paper overflow-hidden', 'flex flex-col')}>
<div className='
<div
className="
mt-4 mb-[32px] ml-6 mr-2
flex-row items-center justify-between
max-[480px]:mb-0 max-[480px]:my-4
'
"
>
<H1
className={clsx(
Expand All @@ -51,7 +52,14 @@ export default async function Page({
>
{recentList.title}
</H1>
<AdFitResponsive className='mx-6 mb-2'/>
<AdFitResponsive
className="mx-6 mb-2"
adfitClassName="adfit-top"
units={{
mobile: 'DAN-dAqcoLWvKpYEtbtq',
pc: 'DAN-SEcRVdSHkh05H0jO',
}}
/>
</div>
<GithubUserList
initialData={userPlugins as UserListItem[]}
Expand Down
9 changes: 8 additions & 1 deletion app/[lang]/sign-in/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ export default async function Page({
'flex flex-col justify-center items-center',
)}
>
<AdFitResponsive className='mx-6 mb-8'/>
<AdFitResponsive
className="mx-6 mb-8"
adfitClassName="adfit-top"
units={{
mobile: 'DAN-dAqcoLWvKpYEtbtq',
pc: 'DAN-SEcRVdSHkh05H0jO',
}}
/>
<div
className={clsx(
'bg-modal max-w-[480px] rounded-2xl px-12 py-16',
Expand Down
8 changes: 7 additions & 1 deletion app/[lang]/stats/[login]/Scouter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ export default function Scouter(props: ScouterProps): ReactElement {
setSelectedStat(name);
}}
/>
<AdFitResponsive/>
<AdFitResponsive
adfitClassName="adfit-top"
units={{
mobile: 'DAN-dAqcoLWvKpYEtbtq',
pc: 'DAN-SEcRVdSHkh05H0jO',
}}
/>
<StatsDetails {...props} selectedStat={selectedStat} />
</div>
);
Expand Down
9 changes: 8 additions & 1 deletion app/[lang]/stats/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ export default async function Page({
<div className="max-[480px]:pt-10 max-[480px]:px-6">
<p className="text-dark dark:text-paper-light">{t.searchUserHint}.</p>
</div>
<AdFitResponsive className="mt-8 max-[480px]:px-6" />
<AdFitResponsive
className="mt-8 max-[480px]:px-6"
adfitClassName="adfit-top"
units={{
mobile: 'DAN-dAqcoLWvKpYEtbtq',
pc: 'DAN-SEcRVdSHkh05H0jO',
}}
/>
</Container>
);
}
16 changes: 0 additions & 16 deletions styles/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -2256,14 +2256,6 @@ input[type='search']::-webkit-search-decoration,
display: none;
}

.max-\[480px\]\:p-6 {
padding: 1.5rem;
}

.max-\[480px\]\:p-2 {
padding: 0.5rem;
}

.max-\[480px\]\:px-0 {
padding-left: 0px;
padding-right: 0px;
Expand All @@ -2274,14 +2266,6 @@ input[type='search']::-webkit-search-decoration,
padding-right: 1.5rem;
}

.max-\[480px\]\:pt-6 {
padding-top: 1.5rem;
}

.max-\[480px\]\:pt-12 {
padding-top: 3rem;
}

.max-\[480px\]\:pt-10 {
padding-top: 2.5rem;
}
Expand Down

1 comment on commit 83ac6f6

@vercel
Copy link

@vercel vercel bot commented on 83ac6f6 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

github-stats – ./

github-stats-hyochan.vercel.app
stats.hyochan.dev
github-stats-git-main-hyochan.vercel.app
stats.dooboo.io

Please sign in to comment.