Skip to content

Commit

Permalink
feat: all site footer
Browse files Browse the repository at this point in the history
  • Loading branch information
521xueweihan committed Sep 10, 2024
1 parent 32e10e9 commit 88b3102
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 67 deletions.
10 changes: 5 additions & 5 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ module.exports = {
userAgent: '*',
allow: '/',
disallow: [
'.jpg$',
'.jpeg$',
'.gif$',
'.png$',
'.bmp$',
'/*.jpg$',
'/*.jpeg$',
'/*.gif$',
'/*.png$',
'/*.bmp$',
'/wp-admin/',
'/wp-includes/',
'/cgi-bin/',
Expand Down
5 changes: 2 additions & 3 deletions src/components/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,13 @@ function Dropdown(props: DropdownProps, ref: any) {
onTouchStart={() => setIsHover(true)}
>
{props.options?.map((opt: option) => (
<a
<span
key={opt.key}
href={`${opt.key}`}
className='block cursor-pointer truncate rounded-lg px-1 py-2 text-left text-sm text-gray-500 hover:bg-gray-50 hover:text-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-gray-300'
onClick={() => onChange(opt)}
>
{opt.value}
</a>
</span>
))}
</div>
</div>
Expand Down
96 changes: 51 additions & 45 deletions src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { CustomLink } from '@/components/links/CustomLink';

import FooterLink from './FooterLink';

import { SideProps } from '@/types/home';
import { FooterProps } from '@/types/home';

const Footer = ({ t }: SideProps) => {
const Footer = ({ t, isLite }: FooterProps) => {
return (
<footer className='flex flex-wrap items-center px-1 py-2.5 text-xs text-gray-400 lg:px-3'>
<footer className='flex flex-wrap items-center px-1 py-2.5 text-xs text-gray-400 lg:px-2'>
<div className='inline-flex space-x-1 lg:space-x-1.5'>
<FeedbackModal feedbackType={2}>
<div className='cursor-pointer hover:text-blue-500'>
Expand Down Expand Up @@ -47,58 +47,64 @@ const Footer = ({ t }: SideProps) => {
</CustomLink>
</p>

<FooterLink href='https://www.ucloud.cn/site/active/kuaijiesale.html?utm_term=logo&utm_campaign=hellogithub&utm_source=otherdsp&utm_medium=display&ytag=logo_hellogithub_otherdsp_display#wulanchabu'>
<div className='mt-2'>
<span>{t('footer.server_sponsor')}</span>
<span className='mx-0.5 align-[1px]'>
<img
className='inline-block'
src='https://img.hellogithub.com/ad/ucloud_footer.png'
width='86'
height='16'
alt='ucloud_footer'
/>
</span>
<span>{t('footer.server_sponsor2')}</span>
</div>
</FooterLink>

<FooterLink href='https://www.upyun.com/league?utm_source=HelloGitHub&utm_medium=adting'>
<div className='mt-2'>
<span>{t('footer.cdn_sponsor')}</span>
<span className='mx-0.5 align-[1px]'>
<img
className='inline-block'
src='https://img.hellogithub.com/ad/upyun_footer.png'
width='42'
height='16'
alt='upyun_footer'
/>
</span>
<span>{t('footer.cdn_sponsor2')}</span>
</div>
</FooterLink>

<FooterLink className='mt-2 block' href='https://beian.miit.gov.cn/'>
<span>京ICP备17046648号-1</span>
<FooterLink
className='mt-2'
href='https://www.ucloud.cn/site/active/kuaijiesale.html?utm_term=logo&utm_campaign=hellogithub&utm_source=otherdsp&utm_medium=display&ytag=logo_hellogithub_otherdsp_display#wulanchabu'
>
<span>{t('footer.server_sponsor')}</span>
<span className='mx-0.5 align-[1px]'>
<img
className='inline-block'
src='https://img.hellogithub.com/ad/ucloud_footer.png'
width='86'
height='16'
alt='ucloud_footer'
/>
</span>
<span>{t('footer.server_sponsor2')}</span>
</FooterLink>

<FooterLink
className='mt-2 block'
href='http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11011402013237'
className='mt-2'
href='https://www.upyun.com/?from=hellogithub'
>
<span>
<span>{t('footer.cdn_sponsor')}</span>
<span className='mx-0.5 align-[1px]'>
<img
className='inline-block'
src='https://img.hellogithub.com/ad/filing.png'
width='12'
height='12'
alt='footer_filing'
src='https://img.hellogithub.com/ad/upyun_footer.png'
width='42'
height='16'
alt='upyun_footer'
/>
京公网安备11011402013237号
</span>
<span>{t('footer.cdn_sponsor2')}</span>
</FooterLink>

{!isLite && (
<FooterLink className='mt-2 block' href='https://beian.miit.gov.cn/'>
<span>京ICP备17046648号-1</span>
</FooterLink>
)}

{!isLite && (
<FooterLink
className='mt-2 block'
href='http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11011402013237'
>
<span>
<img
className='inline-block'
src='https://img.hellogithub.com/ad/filing.png'
width='12'
height='12'
alt='footer_filing'
/>
京公网安备11011402013237号
</span>
</FooterLink>
)}

<p className='mt-2 flex items-center space-x-1 lg:space-x-1.5'>
<span className='cursor-default'>
©{new Date().getFullYear()} HelloGitHub
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/FooterLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const FooterLink: React.FC<FooterLinkProps> = ({
className={`cursor-pointer hover:text-blue-500 ${className}`}
target='_blank'
href={href}
aria-label='footer-link'
rel='noreferrer'
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/components/loading/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const StatsSkeleton = () => {

export const RecommendSkeleton = ({ loop }: Props) => {
return (
<>
<div>
{[...Array(loop)].map((x, i) => (
<div key={i} className='flex flex-row rounded-md py-2'>
<div className='flex w-full items-center px-1'>
Expand All @@ -74,7 +74,7 @@ export const RecommendSkeleton = ({ loop }: Props) => {
</div>
</div>
))}
</>
</div>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/navbar/IndexBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ const IndexBar: NextPage<Props> = ({ t, i18n_lang, tid, sort_by }) => {
<span onClick={handleTagButton} className={linkClassName('label')}>
{t('nav.tag')}
</span>
<div className='shrink grow'></div>
<div className='shrink grow' />
<div className='md:hidden'>
<RepoModal>
<button className='flex h-8 items-center rounded-lg bg-blue-500 px-3 text-xs text-white active:bg-blue-600 dark:bg-gray-700 dark:text-gray-300 dark:active:bg-gray-900 sm:px-4'>
<div className='flex h-8 items-center rounded-lg bg-blue-500 px-3 text-xs text-white active:bg-blue-600 dark:bg-gray-700 dark:text-gray-300 dark:active:bg-gray-900 sm:px-4'>
{t('nav.submit')}
</button>
</div>
</RepoModal>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/navbar/RepoNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ const RepoDetailNavbar = ({ avatar, uid, t }: Props) => {
<NoPrefetchLink href={`/user/${uid}`}>
<div className='flex cursor-pointer items-center justify-end text-xs text-gray-500 hover:text-blue-400 dark:text-gray-400'>
{t('nav.desc')}
<div className='m-1 flex items-center'>
<span className='m-1 flex items-center'>
<img
className='rounded-full hover:animate-spin'
src={avatar}
width='18'
height='18'
alt='navbar_avatar'
/>
</div>
</span>
{t('nav.desc2')}
</div>
</NoPrefetchLink>
Expand Down
18 changes: 15 additions & 3 deletions src/components/report/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,25 @@ export const ChangeColumnRender = (
);
};

export const TrendColumnRender = (row: RankDataItem) => {
export const TrendColumnRender = (
row: RankDataItem,
_showPercent: boolean,
i18n_lang: string
) => {
let icon = <IoMdRemove size={16} />;
if (row.change !== null) {
if (row.change > 0) {
icon = <IoMdTrendingUp size={16} className='text-red-500' />;
if (i18n_lang === 'en') {
icon = <IoMdTrendingUp size={16} className='text-green-500' />;
} else {
icon = <IoMdTrendingUp size={16} className='text-red-500' />;
}
} else {
icon = <IoMdTrendingDown size={16} className=' text-green-500' />;
if (i18n_lang === 'en') {
icon = <IoMdTrendingDown size={16} className='text-red-500' />;
} else {
icon = <IoMdTrendingDown size={16} className=' text-green-500' />;
}
}
}
return <span>{icon}</span>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/side/Recommend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function Recommend({ t }: SideProps) {
</div>
</div>
{repositories.length === 0 ? (
<RecommendSkeleton loop={3} />
<RecommendSkeleton loop={5} />
) : (
<RecommendList repositories={repositories} />
)}
Expand Down
6 changes: 5 additions & 1 deletion src/components/side/Side.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export const Side = ({ isHome }: { isHome: boolean }) => {
)}
{isHome ? <SiteStats t={t} /> : <Recommend t={t} />}
</div>
{isHome && <Footer t={t} />}
{isHome ? (
<Footer t={t} isLite={false} />
) : (
<Footer t={t} isLite={true} />
)}
</div>
</div>
{adverts && (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/periodical/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const PeriodicalIndexPage: NextPage = () => {
<img
src='https://img.hellogithub.com/logo/readme.gif'
alt='HelloGithub'
></img>
/>
<p className='px-1 py-3 leading-7'>
<Trans ns='periodical' i18nKey='p_text' />
</p>
Expand Down Expand Up @@ -199,7 +199,7 @@ const PeriodicalIndexPage: NextPage = () => {
</div>
</dl>
)}
<div className='h-4 lg:h-2'></div>
<div className='h-4' />
</div>
</div>
</>
Expand Down
5 changes: 5 additions & 0 deletions src/types/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export interface SideProps {
t: (key: string) => string;
}

export interface FooterProps {
t: (key: string) => string;
isLite: boolean;
}

export interface HomeItems {
success: boolean;
page: number;
Expand Down

0 comments on commit 88b3102

Please sign in to comment.