mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 14:53:24 +00:00
add switch theme, remove unneeded search bar context
This commit is contained in:
@@ -1,51 +1,28 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import type { ButtonProps } from "tamagui";
|
||||
import React from "react";
|
||||
import { Button, styled } from "tamagui";
|
||||
|
||||
const PrimaryButton = styled(Button, {
|
||||
backgroundColor: "$buttonPrimaryBackground",
|
||||
color: "$buttonPrimaryText",
|
||||
fontWeight: "bold",
|
||||
export const MWButton = styled(Button, {
|
||||
variants: {
|
||||
type: {
|
||||
primary: {
|
||||
backgroundColor: "$buttonPrimaryBackground",
|
||||
color: "$buttonPrimaryText",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
secondary: {
|
||||
backgroundColor: "$buttonSecondaryBackground",
|
||||
color: "$buttonSecondaryText",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
purple: {
|
||||
backgroundColor: "$buttonPurpleBackground",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
cancel: {
|
||||
backgroundColor: "$buttonCancelBackground",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
},
|
||||
} as const,
|
||||
});
|
||||
|
||||
const SecondaryButton = styled(Button, {
|
||||
backgroundColor: "$buttonSecondaryBackground",
|
||||
color: "$buttonSecondaryText",
|
||||
fontWeight: "bold",
|
||||
});
|
||||
|
||||
const PurpleButton = styled(Button, {
|
||||
backgroundColor: "$buttonPurpleBackground",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
});
|
||||
|
||||
const CancelButton = styled(Button, {
|
||||
backgroundColor: "$buttonCancelBackground",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
});
|
||||
|
||||
export const MWButton = React.forwardRef<
|
||||
typeof Button,
|
||||
ButtonProps & {
|
||||
type?: "primary" | "secondary" | "purple" | "cancel";
|
||||
}
|
||||
>((props, ref) => {
|
||||
const { type, ...rest } = props;
|
||||
switch (type) {
|
||||
case "primary":
|
||||
return <PrimaryButton {...rest} ref={ref as any} />;
|
||||
case "secondary":
|
||||
return <SecondaryButton {...rest} ref={ref as any} />;
|
||||
case "purple":
|
||||
return <PurpleButton {...rest} ref={ref as any} />;
|
||||
case "cancel":
|
||||
return <CancelButton {...rest} ref={ref as any} />;
|
||||
default:
|
||||
return <Button {...rest} ref={ref as any} />;
|
||||
}
|
||||
});
|
||||
|
||||
MWButton.displayName = "MWButton";
|
||||
|
Reference in New Issue
Block a user