2023-01-11 19:08:14 +01:00
|
|
|
|
import { downloads as npmDownloads } from '@nodesecure/npm-registry-sdk';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
import type { NextPage } from 'next';
|
|
|
|
|
import styled from 'styled-components';
|
|
|
|
|
import { AvailableFor } from '../components/AvailableFor';
|
|
|
|
|
import { LargeButton } from '../components/Button';
|
2023-01-11 19:08:14 +01:00
|
|
|
|
import { REPO, SUPPORT_LINK } from '../lib/constants';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
import { Explore } from '../components/Explore';
|
2023-01-11 19:08:14 +01:00
|
|
|
|
import { Footer } from '../components/Footer';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
import { Header } from '../components/Header';
|
|
|
|
|
import { HeaderBackground } from '../components/HeaderBackground';
|
|
|
|
|
import { Icon } from '../components/IconList';
|
2023-01-11 19:08:14 +01:00
|
|
|
|
import { Layout } from '../components/Layout';
|
|
|
|
|
import { media } from '../lib/responsive';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
import { SEO } from '../components/SEO';
|
|
|
|
|
import { Stat, StatsContainer } from '../components/Stats';
|
|
|
|
|
import { Text18 } from '../components/Typography';
|
2023-01-11 19:08:14 +01:00
|
|
|
|
import { getHeaderProps } from '../lib/getHeaderProps';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
import { getAllIcons } from '../lib/getIcons';
|
2023-01-09 21:01:41 +01:00
|
|
|
|
import { octokit } from '../lib/octokit';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
|
|
|
|
|
interface HomeProps {
|
|
|
|
|
allIcons: Icon[];
|
|
|
|
|
currentVersion: string;
|
|
|
|
|
numStars: number;
|
|
|
|
|
numDownloads: number;
|
|
|
|
|
}
|
|
|
|
|
const Home: NextPage<HomeProps> = ({
|
|
|
|
|
allIcons,
|
|
|
|
|
currentVersion,
|
|
|
|
|
numStars,
|
|
|
|
|
numDownloads,
|
|
|
|
|
}) => {
|
|
|
|
|
return (
|
|
|
|
|
<Layout>
|
|
|
|
|
<SEO />
|
|
|
|
|
<Header currentVersion={currentVersion} />
|
2023-03-19 21:23:43 +01:00
|
|
|
|
<HeaderBackground>
|
|
|
|
|
<HeroHead>
|
|
|
|
|
<HeroText>Say hello</HeroText>
|
|
|
|
|
<HeroTextSecondary>to your new icon library.</HeroTextSecondary>
|
|
|
|
|
</HeroHead>
|
2022-08-28 20:12:09 +02:00
|
|
|
|
</HeaderBackground>
|
|
|
|
|
<HeroDescription>
|
2023-03-07 22:37:53 +01:00
|
|
|
|
A high-quality selection of free icons. No premium options or sign-ups. Your new alternative to Noun Project, Flaticon, and all Figma resources. Available in SVG,
|
|
|
|
|
Font, React, React Native, Flutter, Figma and Framer.
|
2022-08-28 20:12:09 +02:00
|
|
|
|
</HeroDescription>
|
|
|
|
|
<StatsContainer>
|
|
|
|
|
<Stat
|
2023-01-11 19:08:14 +01:00
|
|
|
|
value={new Intl.NumberFormat('en-US').format(allIcons.length)}
|
2022-08-28 20:12:09 +02:00
|
|
|
|
description={
|
|
|
|
|
'icons available in this very moment, and they’re growing fast!'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Stat
|
|
|
|
|
value={'100%'}
|
|
|
|
|
description={
|
|
|
|
|
'free icons. Iconoir is open source and we’re ready for your help.'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Stat
|
2023-01-11 19:08:14 +01:00
|
|
|
|
value={new Intl.NumberFormat('en-US', { notation: 'compact' }).format(
|
|
|
|
|
numDownloads
|
|
|
|
|
)}
|
2022-08-28 20:12:09 +02:00
|
|
|
|
description={
|
|
|
|
|
'downloads/month on React only. Iconoir also supports React Native, Flutter and CSS.'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Stat
|
2023-01-11 19:08:14 +01:00
|
|
|
|
value={new Intl.NumberFormat('en-US', { notation: 'compact' }).format(
|
|
|
|
|
numStars
|
|
|
|
|
)}
|
2022-08-28 20:12:09 +02:00
|
|
|
|
description={
|
2023-01-11 19:08:14 +01:00
|
|
|
|
'people who starred the project on GitHub. Show your support and be one of them.'
|
2022-08-28 20:12:09 +02:00
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</StatsContainer>
|
|
|
|
|
<AvailableFor />
|
|
|
|
|
<SupportContainer>
|
|
|
|
|
<LargeButton
|
|
|
|
|
as={'a'}
|
|
|
|
|
href={SUPPORT_LINK}
|
|
|
|
|
target={'_blank'}
|
|
|
|
|
rel={'noreferrer'}
|
|
|
|
|
>
|
2023-03-19 21:23:43 +01:00
|
|
|
|
<span>Donate</span>
|
2022-08-28 20:12:09 +02:00
|
|
|
|
</LargeButton>
|
|
|
|
|
<Text18>
|
2023-03-19 21:23:43 +01:00
|
|
|
|
If you find Iconoir valuable for you, consider making a donation to help us pursuing even bigger goals.
|
2022-08-28 20:12:09 +02:00
|
|
|
|
</Text18>
|
|
|
|
|
</SupportContainer>
|
|
|
|
|
<Explore allIcons={allIcons} />
|
|
|
|
|
<Footer />
|
|
|
|
|
</Layout>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2023-03-19 21:23:43 +01:00
|
|
|
|
export const HeroHead = styled.div`
|
|
|
|
|
margin: 60px auto 40px auto;
|
|
|
|
|
${media.md} {
|
|
|
|
|
margin: 160px auto 80px auto;
|
|
|
|
|
}
|
|
|
|
|
`;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
export const HeroText = styled.h1`
|
|
|
|
|
font-size: 50px;
|
|
|
|
|
font-weight: 700;
|
2023-03-19 21:23:43 +01:00
|
|
|
|
color: var(--g0);
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
letter-spacing: -0.035em;
|
|
|
|
|
line-height: 1;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
text-align: center;
|
2023-03-19 21:23:43 +01:00
|
|
|
|
transition: 0.3s;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
${media.md} {
|
|
|
|
|
font-size: 90px;
|
2023-03-19 21:23:43 +01:00
|
|
|
|
padding: 0 20px;
|
|
|
|
|
letter-spacing: -0.045em;
|
|
|
|
|
-webkit-text-stroke: 2.5px;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
}
|
2023-03-19 21:23:43 +01:00
|
|
|
|
&:hover {
|
|
|
|
|
transform:scale(1.04);
|
|
|
|
|
transition:0.3s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
`;
|
|
|
|
|
export const HeroTextSecondary = styled(HeroText)`
|
|
|
|
|
color: var(--g4);
|
|
|
|
|
max-width: 1000px;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
`;
|
|
|
|
|
export const HeroDescription = styled(Text18)<{ topMargin?: number }>`
|
|
|
|
|
display: block;
|
|
|
|
|
max-width: 750px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
text-align: center;
|
|
|
|
|
${media.lg} {
|
|
|
|
|
margin-top: ${(props) => props.topMargin || 0}px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
const SupportContainer = styled.div`
|
|
|
|
|
text-align: center;
|
|
|
|
|
> * {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
max-width: 750px;
|
|
|
|
|
}
|
|
|
|
|
> :not(:last-child) {
|
|
|
|
|
margin-bottom: 30px;
|
|
|
|
|
}
|
|
|
|
|
margin-bottom: 50px;
|
|
|
|
|
${media.sm} {
|
2023-03-19 21:23:43 +01:00
|
|
|
|
margin-bottom: 110px;
|
2022-08-28 20:12:09 +02:00
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2023-03-19 21:23:43 +01:00
|
|
|
|
|
2022-08-28 20:12:09 +02:00
|
|
|
|
export default Home;
|
|
|
|
|
|
|
|
|
|
export async function getStaticProps() {
|
|
|
|
|
const headerProps = getHeaderProps();
|
2023-01-11 19:08:14 +01:00
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
data: { stargazers_count: numStars },
|
|
|
|
|
} = await octokit.rest.repos.get({
|
2023-01-09 21:01:41 +01:00
|
|
|
|
...REPO,
|
|
|
|
|
});
|
2023-01-11 19:08:14 +01:00
|
|
|
|
if (!numStars) throw new Error('Could not find GitHub stars');
|
|
|
|
|
|
|
|
|
|
const { downloads: numDownloads } = await npmDownloads(
|
|
|
|
|
'iconoir-react',
|
|
|
|
|
'last-month'
|
|
|
|
|
);
|
2022-08-28 20:12:09 +02:00
|
|
|
|
if (!numDownloads) throw new Error('Could not find NPM downloads');
|
2023-01-11 19:08:14 +01:00
|
|
|
|
|
2022-08-28 20:12:09 +02:00
|
|
|
|
return {
|
|
|
|
|
props: {
|
|
|
|
|
...headerProps,
|
|
|
|
|
allIcons: await getAllIcons(),
|
2023-01-11 19:08:14 +01:00
|
|
|
|
numStars,
|
2022-08-28 20:12:09 +02:00
|
|
|
|
numDownloads,
|
|
|
|
|
},
|
|
|
|
|
};
|
2023-03-19 21:23:43 +01:00
|
|
|
|
|
2022-08-28 20:12:09 +02:00
|
|
|
|
}
|