Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dhayab committed Feb 7, 2022
0 parents commit 6f9a8c1
Show file tree
Hide file tree
Showing 18 changed files with 8,841 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# typescript
*.tsbuildinfo
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"proseWrap": "never",
"trailingComma": "es5"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# line-stickers-converter

14 changes: 14 additions & 0 deletions components/Sticker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Image, Paper } from '@mantine/core';
import { useStickerPack } from '../utils/useStickerPack';

type Props = {
file: ReturnType<typeof useStickerPack>['files'][0];
};

export default function Sticker({ file }: Props) {
return (
<Paper>
<Image src={URL.createObjectURL(file.blob)} alt={file.name} />
</Paper>
);
}
76 changes: 76 additions & 0 deletions components/StickerPackHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import {
ActionIcon,
Anchor,
Center,
Container,
Group,
Image,
Skeleton,
Text,
ThemeIcon,
useMantineColorScheme,
} from '@mantine/core';
import {
ChevronLeftIcon,
HomeIcon,
MoonIcon,
SunIcon,
} from '@modulz/radix-icons';
import Link from 'next/link';
import { useEffect, useState } from 'react';
import { useStickerPack } from '../utils/useStickerPack';

type Props = Pick<ReturnType<typeof useStickerPack>, 'meta' | 'state'>;

export default function StickerPackHeader({ meta, state }: Props) {
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
const [icon, setIcon] = useState<string | undefined>();
const [loading, setLoading] = useState(true);

useEffect(() => {
if (!loading && meta.icon) {
setIcon(URL.createObjectURL(meta.icon));
}
}, [loading, meta]);

useEffect(() => {
state === 'loaded' && setLoading(false);
}, [state]);

return (
<Container my="xs">
<Group sx={{ justifyContent: 'space-between' }}>
<Group spacing="xs">
<Link href="/" passHref>
<ThemeIcon variant="light" color="violet">
<ChevronLeftIcon />
</ThemeIcon>
</Link>
<Skeleton width={60} height={60} visible={loading}>
{icon && <Image height={60} src={icon} alt={meta.name} />}
</Skeleton>
<Center>
<Container padding={0}>
<Skeleton visible={loading}>
<Text weight="bold" size="sm">
{meta.name}
</Text>
<Text size="sm" color="dimmed">
{meta.count} stickers
</Text>
</Skeleton>
</Container>
</Center>
</Group>
<ActionIcon
variant="outline"
color={colorScheme === 'light' ? 'blue' : 'yellow'}
onClick={() => toggleColorScheme()}
title="Toggle color scheme"
>
{colorScheme === 'light' ? <MoonIcon /> : <SunIcon />}
</ActionIcon>
</Group>
</Container>
);
}
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
Loading

0 comments on commit 6f9a8c1

Please sign in to comment.