Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: responsiveness header redemption widget #626

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/react-kit/src/components/magicLink/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { useUser } from "./UserContext";
import { useMagic } from "../../hooks";
import { Button } from "../buttons/Button";
import { Spinner } from "../ui/loading/Spinner";

type MagicLoginButtonProps = Omit<
Parameters<typeof Button>[0],
"onClick" | "disabled"
>;
export const MagicLoginButton = (props: MagicLoginButtonProps) => {
type MagicLoginButtonProps = {
buttonProps: Omit<Parameters<typeof Button>[0], "onClick" | "disabled">;
};
export const MagicLoginButton = ({ buttonProps }: MagicLoginButtonProps) => {
const magic = useMagic();
const { setUser } = useUser();
const [disabled, setDisabled] = useState(false);
Expand All @@ -35,7 +33,7 @@ export const MagicLoginButton = (props: MagicLoginButtonProps) => {
};

return (
<Button {...props} onClick={connect} disabled={disabled}>
<Button {...buttonProps} onClick={connect} disabled={disabled}>
{loading ? (
<>
Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const InnerMagicProvider = ({
.catch(() => console.info("magic link could not be preloaded"));
return {
magic: magic as typeof magic & { uuid: string },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
magicProvider: new ethers.providers.Web3Provider(magic.rpcProvider as any)
}; // return magic provider too
}, [chainId, magicLinkKey, rpcUrls]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React, { useEffect } from "react";
import { Exchange } from "../../../../../types/exchange";
import Confirmation, { ConfirmationProps } from "./Confirmation";
import { NonModalProps, useNonModalContext } from "../../../nonModal/NonModal";
import Typography from "../../../../ui/Typography";
import { theme } from "../../../../../theme";
import { RedeemHeader } from "../RedeemHeader";
import { useAccount } from "../../../../../hooks/connection/connection";

const colors = theme.colors.light;
Expand Down Expand Up @@ -34,11 +34,7 @@ export function ConfirmationView({
useEffect(() => {
dispatch({
payload: {
headerComponent: (
<Typography tag="h3" $width="100%">
Redeem your item
</Typography>
),
headerComponent: RedeemHeader,
contentStyle: {
background: colors.white
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from "react";
import Grid from "../../../../ui/Grid";
import Typography from "../../../../ui/Typography";
import { ArrowLeft } from "phosphor-react";
import { Exchange } from "../../../../../types/exchange";
import ContractualAgreement from "../../../../contractualAgreement/ContractualAgreement";
Expand All @@ -21,13 +20,13 @@ export function ContractualAgreementView({ onBackClick, exchange }: Props) {
dispatch({
payload: {
headerComponent: (
<Grid>
<Grid style={{ flex: "1" }}>
<ArrowLeft
onClick={onBackClick}
size={32}
style={{ cursor: "pointer" }}
/>
<Typography tag="h3">Contractual Agreement</Typography>
<h3 style={{ width: "100%", flex: 1 }}>Contractual Agreement</h3>
</Grid>
),
contentStyle: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function ExchangePolicy({
dispatch({
payload: {
headerComponent: (
<Grid gap="1rem">
<Grid gap="1rem" style={{ flex: "1" }}>
<ArrowLeft
onClick={onBackClick}
size={32}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export function ExchangeFullDescriptionView({ onBackClick, exchange }: Props) {
dispatch({
payload: {
headerComponent: (
<Grid>
<Grid style={{ flex: "1" }}>
<ArrowLeft
onClick={onBackClick}
size={32}
style={{ cursor: "pointer" }}
/>
<Typography tag="h3">
<Typography tag="h3" style={{ flex: "1" }}>
{exchange?.offer.metadata.name || ""}
</Typography>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function ExchangeView({
dispatch({
payload: {
headerComponent: (
<Grid gap="1rem">
<Grid gap="1rem" style={{ flex: "1" }}>
<House
onClick={onHouseClick}
size={32}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Button } from "../../../../buttons/Button";
import GridContainer from "../../../../ui/GridContainer";
import { useRedemptionContext } from "../../../../widgets/redemption/provider/RedemptionContext";
import { useNonModalContext } from "../../../nonModal/NonModal";
import { RedeemHeader } from "../RedeemHeader";

const colors = theme.colors.light;

Expand Down Expand Up @@ -61,15 +62,13 @@ export function RedeemSuccess({
dispatch({
payload: {
headerComponent: (
<Grid>
<Grid style={{ flex: "1" }}>
<House
onClick={onHouseClick}
size={32}
style={{ cursor: "pointer", flexShrink: 0 }}
/>
<Typography tag="h3" $width="100%">
Redeem your item
</Typography>
{RedeemHeader}
</Grid>
),
contentStyle: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export const CancellationView: React.FC<CancellationViewProps> = ({
dispatch({
payload: {
headerComponent: isCancelModeOnly ? (
<Grid gap="1rem">
<Grid gap="1rem" style={{ flex: "1" }}>
<Typography tag="h3" style={{ flex: "1 1" }}>
Cancel exchange
</Typography>
</Grid>
) : (
<Grid gap="1rem">
<Grid gap="1rem" style={{ flex: "1" }}>
<ArrowLeft
onClick={onBackClick}
size={32}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect } from "react";
import Typography from "../../../../../ui/Typography";
import { ArrowLeft } from "phosphor-react";
import { Exchange } from "../../../../../../types/exchange";
import ExpireVoucher, { ExpireVoucherProps } from "./ExpireVoucher";
import { useNonModalContext } from "../../../../nonModal/NonModal";
import { theme } from "../../../../../../theme";
import Grid from "../../../../../ui/Grid";

const colors = theme.colors.light;
export interface ExpireVoucherViewProps {
Expand All @@ -23,14 +23,14 @@ export const ExpireVoucherView: React.FC<ExpireVoucherViewProps> = ({
dispatch({
payload: {
headerComponent: (
<>
<Grid style={{ flex: "1" }} gap="1rem">
<ArrowLeft
onClick={() => onBackClick()}
size={32}
style={{ cursor: "pointer" }}
/>
<Typography tag="h3">Expire voucher</Typography>
</>
<h3 style={{ width: "100%", flex: 1 }}>Expire voucher</h3>
</Grid>
),
contentStyle: {
background: colors.white
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from "react";
import Grid from "../../../../ui/Grid";
import Typography from "../../../../ui/Typography";
import { ArrowLeft } from "phosphor-react";
import { Exchange } from "../../../../../types/exchange";
import License from "../../../../license/License";
Expand All @@ -19,13 +18,13 @@ export function LicenseAgreementView({ onBackClick, exchange }: Props) {
dispatch({
payload: {
headerComponent: (
<Grid>
<Grid style={{ flex: "1" }} gap="1rem">
<ArrowLeft
onClick={onBackClick}
size={32}
style={{ cursor: "pointer" }}
/>
<Typography tag="h3">License Agreement</Typography>
<h3 style={{ width: "100%", flex: 1 }}>License Agreement</h3>
</Grid>
),
contentStyle: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { useEffect } from "react";
import { useBuyers } from "../../../../../hooks/useBuyers";
import { Checkbox } from "../../../../form";
import Loading from "../../../../ui/loading/Loading";
import Typography from "../../../../ui/Typography";
import Exchanges from "./Exchanges";
import { ExchangesStates, WithExchangesData } from "./WithExchangesData";
import { Exchange } from "../../../../../types/exchange";
Expand Down Expand Up @@ -47,9 +46,7 @@ export function MyItems({
dispatch({
payload: {
headerComponent: (
<Typography tag="h3" $width="100%">
Manage your exchanges
</Typography>
<h3 style={{ width: "100%", flex: 1 }}>Manage your exchanges</h3>
),
contentStyle: {
background: colors.lightGrey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect } from "react";
import Typography from "../../../../ui/Typography";
import RedeemForm from "./RedeemForm";
import { useNonModalContext } from "../../../nonModal/NonModal";
import { Exchange } from "../../../../../types/exchange";
import { theme } from "../../../../../theme";
import { useAccount } from "../../../../../hooks/connection/connection";
import { RedeemHeader } from "../RedeemHeader";

const colors = theme.colors.light;

Expand All @@ -26,11 +26,7 @@ export default function RedeemFormView({
useEffect(() => {
dispatch({
payload: {
headerComponent: (
<Typography tag="h3" $width="100%">
Redeem your item
</Typography>
),
headerComponent: RedeemHeader,
contentStyle: {
background: colors.white
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from "react";
export const RedeemHeader = (
<h3 style={{ width: "100%", flex: 1 }}>Redeem your item</h3>
);
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { ContactPreference } from "./const";
import useCheckExchangePolicy from "../../../../hooks/useCheckExchangePolicy";
import { useConvertionRate } from "../../../widgets/finance/convertion-rate/useConvertionRate";
import NonModal, { NonModalProps } from "../../nonModal/NonModal";
import Typography from "../../../ui/Typography";
import { useConfigContext } from "../../../config/ConfigContext";
import {
RedemptionWidgetAction,
Expand All @@ -48,6 +47,7 @@ import {
import { BosonFooter } from "./BosonFooter";
import { theme } from "../../../../theme";
import { useAccount } from "../../../../hooks/connection/connection";
import { RedeemHeader } from "./RedeemHeader";

const colors = theme.colors.light;
enum ActiveStep {
Expand Down Expand Up @@ -98,11 +98,7 @@ export default function RedeemWrapper({
<NonModal
props={{
hideModal,
headerComponent: (
<Typography tag="h3" $width="100%">
Redeem your item
</Typography>
),
headerComponent: RedeemHeader,
footerComponent: <BosonFooter />,
contentStyle: {
background: colors.white
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect } from "react";
import PurchaseOverview from "./PurchaseOverview";
import { useNonModalContext } from "../../../nonModal/NonModal";
import { theme } from "../../../../../theme";
import Grid from "../../../../ui/Grid";

const colors = theme.colors.light;
type Props = {
Expand All @@ -14,11 +15,13 @@ export function PurchaseOverviewView({ onBackClick }: Props) {
dispatch({
payload: {
headerComponent: (
<ArrowLeft
onClick={onBackClick}
size={32}
style={{ cursor: "pointer", flexShrink: 0 }}
/>
<Grid style={{ flex: "1" }}>
<ArrowLeft
onClick={onBackClick}
size={32}
style={{ cursor: "pointer" }}
/>
</Grid>
),
contentStyle: {
background: colors.white
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { CommitStep } from "./style";
import Step from "../../../../ui/Step";
import { breakpoint } from "../../../../../lib/ui/breakpoint";
import { useNonModalContext } from "../../../nonModal/NonModal";
import Typography from "../../../../ui/Typography";
import { theme } from "../../../../../theme";
import { RedeemHeader } from "../RedeemHeader";

const colors = theme.colors.light;
const CommitStepWrapper = styled.div`
Expand Down Expand Up @@ -50,11 +50,7 @@ export default function StepsOverview({ onNextClick }: Props) {
useEffect(() => {
dispatch({
payload: {
headerComponent: (
<Typography tag="h3" $width="100%">
Redeem your item
</Typography>
),
headerComponent: RedeemHeader,
contentStyle: {
background: colors.white
}
Expand Down
Loading
Loading