-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from 0xWrapper/testnet
grid to wrapper gallery
- Loading branch information
Showing
17 changed files
with
502 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
images: { | ||
dangerouslyAllowSVG: true, | ||
domains: ['wrapper.space','localhost'], // 添加你允许加载图片的域名 | ||
}, | ||
}; | ||
|
||
export default nextConfig; | ||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import GalleryWrapper from "../layout/gallery-wrapper"; | ||
import WrapperCreate from "./wrapper-create"; | ||
|
||
type WrapperCellProps = { | ||
items: any[], | ||
columnCount: number, | ||
}; | ||
export const Cell = ({ columnIndex, rowIndex, style, data }: { columnIndex: number, rowIndex: number, style: any, data: WrapperCellProps }) => { | ||
const index = rowIndex * data.columnCount + columnIndex; | ||
if (index === 0) { | ||
return ( | ||
<div style={style} className="p-2"> | ||
{/* 将物品放入新Wrapper */} | ||
<WrapperCreate | ||
title="Create Wrapper" | ||
/> | ||
</div> | ||
); | ||
} else { | ||
if (!data.items[index - 1]) { | ||
return null; | ||
} | ||
const wrapper = data.items[index - 1].data; | ||
return ( | ||
<div style={style} className="p-2"> | ||
{/* 将物品放入已存在的Wrapper */} | ||
<GalleryWrapper | ||
wrapperProps={ | ||
{ | ||
id: wrapper.objectId, | ||
alias: wrapper.display.data?.alias, | ||
kind: wrapper.display.data?.kind, | ||
image_url: wrapper.display.data?.image_url, | ||
} | ||
} | ||
/> | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useDrop } from 'react-dnd'; | ||
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '../ui/card'; | ||
import { Button } from '../ui/button'; | ||
import { LogoIcon } from '../layout/logo'; | ||
|
||
// dnd | ||
const handleDropNewWrapper = (item: any) => { | ||
console.log("Creating new wrapper with:", item); | ||
// 添加创建新的wrapper的逻辑 | ||
}; | ||
|
||
export default function WrapperCreate({ | ||
title, | ||
}: { | ||
title: string, | ||
}) { | ||
const [{ isOver }, drop] = useDrop(() => ({ | ||
accept: 'object', | ||
drop: (item) => handleDropNewWrapper(item), | ||
collect: (monitor) => ({ | ||
isOver: monitor.isOver(), | ||
}), | ||
})); | ||
|
||
return ( | ||
// @ts-ignore | ||
<Card ref={drop} className={`w-full bg-white ${isOver ? 'bg-gray-200' : ''}`}> | ||
<CardHeader className="tracking-wide"> | ||
<CardTitle >{title}</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<LogoIcon height={200} width={200} /> | ||
</CardContent> | ||
<CardFooter className="flex justify-center"> | ||
<Button variant="secondary">Create</Button> | ||
</CardFooter> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.