-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
172 additions
and
22 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,21 @@ | ||
import alipay from '@/assets/alipay.jpg' | ||
import a6 from '@/assets/qrCord/a6.png' | ||
import a12 from '@/assets/qrCord/a12.png' | ||
import a36 from '@/assets/qrCord/a36.png' | ||
import a50 from '@/assets/qrCord/a50.png' | ||
import a66 from '@/assets/qrCord/a66.png' | ||
import w6 from '@/assets/qrCord/w6.png' | ||
import w12 from '@/assets/qrCord/w12.png' | ||
import w36 from '@/assets/qrCord/w36.png' | ||
import w50 from '@/assets/qrCord/w50.png' | ||
import w66 from '@/assets/qrCord/w66.png' | ||
import weChat from '@/assets/weChat.jpg' | ||
|
||
export const AmountImageMap = { | ||
'-1': [alipay, weChat], | ||
6: [a6, w6], | ||
12: [a12, w12], | ||
36: [a36, w36], | ||
50: [a50, w50], | ||
66: [a66, w66], | ||
} |
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,23 @@ | ||
import type { AmountType } from '..' | ||
|
||
export const Amount = ({ | ||
amount, | ||
onClick, | ||
active = true, | ||
}: { | ||
amount: AmountType | ||
onClick?: (amount: AmountType) => void | ||
active: boolean | ||
}) => { | ||
return ( | ||
<button | ||
className={` focus: h-10 rounded border-gray-100 font-bold text-gray-700 shadow-md shadow-gray-300 | ||
outline-none hover:bg-gray-100 dark:bg-gray-700 dark:text-gray-300 dark:text-opacity-80 dark:opacity-80 | ||
dark:shadow-gray-700 hover:dark:bg-gray-600 | ||
${amount === -1 ? 'w-18' : 'w-10'} ${active ? 'bg-stone-100 dark:bg-gray-500' : ''}`} | ||
onClick={() => onClick && onClick(amount)} | ||
> | ||
{amount === -1 ? '自定义' : amount} | ||
</button> | ||
) | ||
} |
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,37 @@ | ||
import sticker2 from '@/assets/sticker2.jpg' | ||
import sticker1 from '@/assets/sticker.jpg' | ||
import { Tooltip } from 'react-tooltip' | ||
import 'react-tooltip/dist/react-tooltip.css' | ||
import IconInfo from '~icons/ic/outline-info' | ||
import SolarStickerSmileSquareOutline from '~icons/solar/sticker-smile-square-outline' | ||
|
||
export const StickerButton = ({ className }: { className?: string }) => { | ||
return ( | ||
<> | ||
<div | ||
data-tooltip-id="sticker-btn" | ||
className={`w-max cursor-pointer rounded border-2 border-dashed border-gray-300 p-1.5 indent-0 text-sm font-bold text-gray-500 transition-all hover:border-indigo-500 hover:text-indigo-500 | ||
dark:text-gray-300 | ||
${className}`} | ||
> | ||
<SolarStickerSmileSquareOutline className="mb-[2px] mr-2 inline-block text-sm " /> | ||
查看贴纸 | ||
</div> | ||
<Tooltip | ||
id="sticker-btn" | ||
opacity={1} | ||
className="flex flex-col items-center justify-center gap-2 rounded-lg !bg-gray-100 !p-4 shadow-lg shadow-gray-300 | ||
dark:!bg-gray-800 dark:text-gray-300 dark:shadow-lg dark:shadow-gray-700" | ||
> | ||
<div className="flex gap-2"> | ||
<img src={sticker1} alt="alipay" className=" h-44 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" /> | ||
<img src={sticker2} alt="alipay" className=" h-44 rounded shadow-lg shadow-gray-300 dark:shadow-gray-700" /> | ||
</div> | ||
<span className="mt-3 text-xs font-bold text-gray-500"> | ||
<IconInfo className="mb-[3px] mr-1 inline-block" /> | ||
此贴纸非商品,仅用于感谢您的捐赠,不可用于任何商业用途 | ||
</span> | ||
</Tooltip> | ||
</> | ||
) | ||
} |
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,50 @@ | ||
import { AmountImageMap } from './AmountQrMap' | ||
import { Amount } from './components/Amount' | ||
import { useEffect, useState } from 'react' | ||
|
||
export type AmountType = -1 | 6 | 12 | 36 | 50 | 66 | ||
const displayAmount: AmountType[] = [6, 12, 36, 50, 66, -1] | ||
|
||
export const DonatingCard = ({ className, onAmountChange }: { className?: string; onAmountChange?: (amount: AmountType) => void }) => { | ||
const [amount, setAmount] = useState<AmountType | undefined>(undefined) | ||
|
||
const onClickAmount = (amount: AmountType) => { | ||
setAmount(amount) | ||
} | ||
|
||
useEffect(() => { | ||
onAmountChange && amount && onAmountChange(amount as AmountType) | ||
}, [amount, onAmountChange]) | ||
|
||
return ( | ||
<div className={`flex w-full flex-col items-center justify-center gap-3 ${className && className}`}> | ||
<h2 className="self-start pl-10 font-bold text-gray-800 dark:text-gray-300">选择您的捐赠金额:</h2> | ||
<div className="mt-2 flex gap-3"> | ||
{displayAmount.map((a) => { | ||
return <Amount active={a === amount} key={a} amount={a} onClick={onClickAmount} /> | ||
})} | ||
</div> | ||
|
||
<div className={`mt-3 flex w-full flex-col overflow-hidden px-11 transition-[height] duration-500 ${amount ? 'h-44' : 'h-0'}`}> | ||
{amount && ( | ||
<div className="flex w-full justify-between"> | ||
<img src={AmountImageMap[amount][0]} alt="alipay" className=" h-44" /> | ||
<img src={AmountImageMap[amount][1]} alt="weChat" className=" h-44" /> | ||
</div> | ||
)} | ||
</div> | ||
{amount && (amount >= 50 || amount === -1) && ( | ||
<span> | ||
<a | ||
className="text-sm font-bold text-gray-500 underline-offset-4 hover:underline dark:text-gray-400" | ||
href="https://wj.qq.com/s2/13329666/380d/" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
贴纸寄送地址问卷 | ||
</a> | ||
</span> | ||
)} | ||
</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
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
8db4c58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
qwerty-learner – ./
qwerty-learner-kai42.vercel.app
qwerty-learner.vercel.app
qwerty-learner-git-master-kai42.vercel.app
qwerty.cool
qwerty.kaiyi.cool
kai42.cool