Refactor announcement components and styles

master^2
Tudor Stanciu 2024-03-25 02:46:14 +02:00
parent cbca462893
commit 4ab78e51cd
3 changed files with 12 additions and 14 deletions

View File

@ -1,17 +1,16 @@
import React from "react";
import { makeStyles } from "@mui/material/styles";
import { Alert, AlertTitle } from "@mui/material";
import styles from "../styles";
import { getStyles } from "../styles";
import { useTranslation } from "react-i18next";
const useStyles = makeStyles(styles);
import { useTheme } from "@mui/material/styles";
export default function GuestAnnouncement() {
const classes = useStyles();
const { t } = useTranslation();
const theme = useTheme();
const styles = getStyles(theme);
return (
<div className={classes.alert}>
<div style={styles.alert}>
<Alert variant="outlined" severity="warning">
<AlertTitle>{t("Dashboard.Announcements.Guest.Title")}</AlertTitle>
{t("Dashboard.Announcements.Guest.Message")}

View File

@ -1,19 +1,18 @@
import React from "react";
import { makeStyles } from "@mui/material/styles";
import { Alert, AlertTitle } from "@mui/material";
import styles from "../styles";
import { getStyles } from "../styles";
import { useTranslation } from "react-i18next";
import { useTuitioUser } from "@flare/tuitio-client-react";
const useStyles = makeStyles(styles);
import { useTheme } from "@mui/material/styles";
export default function UserAnnouncement() {
const classes = useStyles();
const { t } = useTranslation();
const { userName } = useTuitioUser();
const theme = useTheme();
const styles = getStyles(theme);
return (
<div className={classes.alert}>
<div style={styles.alert}>
<Alert variant="outlined" severity="info">
<AlertTitle>
{t("Dashboard.Announcements.User.Title", {

View File

@ -1,4 +1,4 @@
const styles = theme => ({
const getStyles = theme => ({
alert: {
width: "100%",
"& > * + *": {
@ -7,4 +7,4 @@ const styles = theme => ({
}
});
export default styles;
export { getStyles };