Skip to content

Commit c2b5c77

Browse files
committed
remix로 포팅작업 1단계
1 parent 1453464 commit c2b5c77

File tree

153 files changed

+5419
-12029
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+5419
-12029
lines changed

.gitignore

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.next
21
node_modules
3-
.env
4-
.DS_STORE
5-
public
2+
63
.cache
7-
.vscode
8-
.env.*
9-
run.sh
10-
src/__generated__
114
.vercel
5+
.output
6+
7+
public/build
8+
api/_build
9+
generated*.ts
10+
11+
legacy

.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"htmlWhitespaceSensitivity": "css",
99
"proseWrap": "preserve",
1010
"quoteProps": "as-needed",
11-
"tabWidth": 2
11+
"tabWidth": 2,
12+
"printWidth": 120
1213
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

README.md

+32-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
1-
# Band idios homepage
1+
# Welcome to Remix!
22

3-
using gatsby.js
3+
- [Remix Docs](https://remix.run/docs)
44

5-
https://idiots.band
5+
## Deployment
6+
7+
After having run the `create-remix` command and selected "Vercel" as a deployment target, you only need to [import your Git repository](https://vercel.com/new) into Vercel, and it will be deployed.
8+
9+
If you'd like to avoid using a Git repository, you can also deploy the directory by running [Vercel CLI](https://vercel.com/cli):
10+
11+
```sh
12+
npm i -g vercel
13+
vercel
14+
```
15+
16+
It is generally recommended to use a Git repository, because future commits will then automatically be deployed by Vercel, through its [Git Integration](https://vercel.com/docs/concepts/git).
17+
18+
## Development
19+
20+
To run your Remix app locally, make sure your project's local dependencies are installed:
21+
22+
```sh
23+
npm install
24+
```
25+
26+
Afterwards, start the Remix development server like so:
27+
28+
```sh
29+
npm run dev
30+
```
31+
32+
Open up [http://localhost:3000](http://localhost:3000) and you should be ready to go!
33+
34+
If you're used to using the `vercel dev` command provided by [Vercel CLI](https://vercel.com/cli) instead, you can also use that, but it's not needed.

api/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const { createRequestHandler } = require("@remix-run/vercel");
2+
3+
module.exports = createRequestHandler({
4+
build: require("./_build")
5+
});

app/components/GoodsImage.tsx

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Box, AspectRatio, Image } from '@chakra-ui/react'
2+
import { StrapiImage } from '~/types/types'
3+
import { formatsToUrl } from '~/utils/image'
4+
5+
interface Props {
6+
imageRatio?: number
7+
image: StrapiImage
8+
isSoldOut: boolean
9+
alt: string
10+
}
11+
12+
export default function GoodsImage({ imageRatio = 1, image, isSoldOut = false, alt }: Props) {
13+
return (
14+
<Box position="relative">
15+
<AspectRatio ratio={imageRatio} w="100%" objectFit="contain" bgColor="blackAlpha.700">
16+
<Image src={formatsToUrl(image?.formats)} objectFit="contain" objectPosition="50% 50%" alt={alt} />
17+
</AspectRatio>
18+
{isSoldOut && (
19+
<Box
20+
position="absolute"
21+
display="flex"
22+
top="0"
23+
left="0"
24+
zIndex="10"
25+
w="100%"
26+
h="100%"
27+
bgColor="blackAlpha.700"
28+
justifyContent="center"
29+
alignItems="center"
30+
>
31+
<Box bgColor="gray.900" padding="16px" borderRadius="16px">
32+
Soldout!
33+
</Box>
34+
</Box>
35+
)}
36+
</Box>
37+
)
38+
}

app/components/MarkdownText.tsx

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Box, BoxProps } from '@chakra-ui/react'
2+
import { isEmpty, isNil } from 'lodash'
3+
4+
/*
5+
const markdownIt = new MarkdownIt({
6+
html: true,
7+
linkify: true,
8+
typographer: true,
9+
})
10+
*/
11+
interface Props extends BoxProps {
12+
markdown?: string
13+
}
14+
15+
const HASHTAG_REGEX = /#([-|-|-|a-z|A-Z|0-9]+)/g
16+
const MENTION_REGEX = /@([0-9|a-z|A-Z\d-_.]+)/g
17+
/*
18+
const toHTML = (markdown: string) =>
19+
markdownIt.render(
20+
markdown
21+
.replace(/\n/g, '<br />')
22+
.replace(HASHTAG_REGEX, '<a class="hashtag" href="https://twitter.com/search?q=$1">#$1</a>')
23+
.replace(
24+
MENTION_REGEX,
25+
'<a class="twitter-link" href="https://twitter.com/$1" target="_blank" rel="noopener noreferrer">@$1</a>'
26+
)
27+
)
28+
*/
29+
export default function MarkdownText({ markdown, ...restProps }: Props) {
30+
if (isEmpty(markdown) || isNil(markdown)) {
31+
return null
32+
}
33+
return (
34+
<>
35+
<Box
36+
dangerouslySetInnerHTML={{
37+
__html: markdown
38+
.replace(/\n/g, '<br />')
39+
.replace(
40+
HASHTAG_REGEX,
41+
'<a class="hashtag" href="https://twitter.com/search?q=$1"target="_blank" rel="noopener noreferrer">#$1</a>'
42+
)
43+
.replace(
44+
MENTION_REGEX,
45+
'<a class="twitter-link" href="https://twitter.com/$1" target="_blank" rel="noopener noreferrer">@$1</a>'
46+
),
47+
}}
48+
{...restProps}
49+
/>
50+
</>
51+
)
52+
}

app/components/NavMenu.tsx

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { Box, BoxProps } from '@chakra-ui/react'
2+
import { Link } from 'remix'
3+
4+
interface Props extends BoxProps {
5+
link: string
6+
title: string
7+
text: string
8+
}
9+
export default function NavMenu({ link, title, text, onClick, ...restProps }: Props) {
10+
const linkItem = (
11+
<Box marginLeft="12px" marginRight="12px" {...restProps}>
12+
{text}
13+
</Box>
14+
)
15+
16+
if (link.startsWith('/')) {
17+
return (
18+
<Link to={link} title={title}>
19+
{linkItem}
20+
</Link>
21+
)
22+
} else {
23+
return (
24+
<a href={link} target="_blank" rel="noopener noreferrer">
25+
{linkItem}
26+
</a>
27+
)
28+
}
29+
}

app/components/PageContent.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Box } from '@chakra-ui/react'
2+
3+
interface Props {
4+
children: React.ReactNode | React.ReactNode[]
5+
}
6+
export default function PageContent({ children }: Props) {
7+
return (
8+
<Box maxW={['100%', null, null, '1366px']} margin="0 auto" padding={['8px', null, '16px', '24px']}>
9+
{children}
10+
</Box>
11+
)
12+
}

app/components/ScrollDescription.tsx

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Box, BoxProps } from '@chakra-ui/react'
2+
import React from 'react'
3+
4+
interface Props extends BoxProps {
5+
children: React.ReactNode
6+
}
7+
8+
export default function ScrollDescription({ children, ...boxProps }: Props) {
9+
return (
10+
<Box
11+
bgColor="whiteAlpha.100"
12+
maxH="300px"
13+
overflowY="auto"
14+
css={{
15+
'&::-webkit-scrollbar': {
16+
width: '8px',
17+
},
18+
'&::-webkit-scrollbar-track': {
19+
width: '6px',
20+
},
21+
'&::-webkit-scrollbar-thumb': {
22+
background: 'white',
23+
borderRadius: '24px',
24+
},
25+
}}
26+
{...boxProps}
27+
>
28+
{children}
29+
</Box>
30+
)
31+
}

app/entry.client.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { hydrate } from "react-dom";
2+
import { RemixBrowser } from "remix";
3+
4+
hydrate(<RemixBrowser />, document);

app/entry.server.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { renderToString } from "react-dom/server";
2+
import { RemixServer } from "remix";
3+
import type { EntryContext } from "remix";
4+
5+
export default function handleRequest(
6+
request: Request,
7+
responseStatusCode: number,
8+
responseHeaders: Headers,
9+
remixContext: EntryContext
10+
) {
11+
const markup = renderToString(
12+
<RemixServer context={remixContext} url={request.url} />
13+
);
14+
15+
responseHeaders.set("Content-Type", "text/html");
16+
17+
return new Response("<!DOCTYPE html>" + markup, {
18+
status: responseStatusCode,
19+
headers: responseHeaders
20+
});
21+
}

0 commit comments

Comments
 (0)