-
Notifications
You must be signed in to change notification settings - Fork 14
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
implemented delete account popup #119
implemented delete account popup #119
Conversation
WalkthroughA new React functional component for account deletion confirmation has been introduced in the project. This component, located in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 7
🧹 Outside diff range and nitpick comments (3)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (2)
15-15
: Consider renaming the component for clarity.The component is currently named
index
, which is not descriptive. Consider renaming it to something more specific, likeDeleteAccountConfirmation
.Here's a suggested change:
-const index: React.FC<DeleteAccountConfirmationProps> = ({ open, onClose }) => { +const DeleteAccountConfirmation: React.FC<DeleteAccountConfirmationProps> = ({ open, onClose }) => {Remember to update the export statement as well.
47-47
: Update export statement if component is renamed.If you rename the component as suggested earlier, don't forget to update the export statement accordingly.
Here's the suggested change:
-export default index; +export default DeleteAccountConfirmation;Clients/src/presentation/pages/SettingsPage/Profile/index.tsx (1)
119-119
: Addalt
attribute toAvatar
component for accessibilityThe
Avatar
component should include analt
attribute to improve accessibility for users relying on screen readers.Apply this diff to add the
alt
attribute:<Avatar src={profilePhoto} + alt="User Profile Photo" sx={{ width: 80, height: 80 }} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (1 hunks)
- Clients/src/presentation/pages/SettingsPage/Profile/index.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (5)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (3)
1-8
: LGTM: Imports are correct and well-organized.The necessary Material-UI components are imported and grouped together, which is a good practice for readability.
10-13
: LGTM: Props interface is well-defined.The
DeleteAccountConfirmationProps
interface is correctly defined with appropriate props for a confirmation dialog component. The naming convention follows React best practices.
21-45
: LGTM: Dialog structure and implementation are well-organized.The Dialog component is correctly structured using Material-UI components. It includes all necessary parts (title, content, actions) and the "Delete Account" button is appropriately styled with
color="error"
.Clients/src/presentation/pages/SettingsPage/Profile/index.tsx (2)
101-102
:⚠️ Potential issueUpdate
Field
component to useFollowing the renaming of
password
toField
component for the email input uses the correct state variable.Apply this diff to update the component:
<Field id="Email" label="Email" - value={password} - onChange={(e) => setPassword(e.target.value)} + value={email} + onChange={(e) => setEmail(e.target.value)} sx={{ mb: 5, backgroundColor: "#FFFFFF" }} />Likely invalid or redundant comment.
6-6
: Verify the import path ofDeleteAccountConfirmation
componentEnsure that the
DeleteAccountConfirmation
component exists at the specified path and the import statement is correct.Run the following script to verify the existence of the component file:
const handleDelete = () => { | ||
console.log("Account deleted"); | ||
onClose(); | ||
}; |
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.
Implement actual delete functionality in handleDelete
.
The current implementation only logs a message. For a production environment, this function should integrate with your backend API to perform the actual account deletion.
Consider updating the function to something like this:
const handleDelete = async () => {
try {
await deleteAccount(); // Call your API function here
console.log("Account deleted successfully");
onClose();
} catch (error) {
console.error("Failed to delete account:", error);
// Handle error (e.g., show an error message to the user)
}
};
spacing={2} | ||
alignItems={"center"} | ||
sx={{ paddingTop: theme.spacing(19) }} | ||
> |
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.
🛠️ Refactor suggestion
Adjust layout to improve responsiveness and alignment
Using a large paddingTop
value (theme.spacing(19)
) may lead to alignment issues on different screen sizes. Consider leveraging FlexBox
or Grid
for better layout control and responsiveness.
For example, you can adjust the Stack
component or use justifyContent
and alignItems
properties to center the content without excessive padding.
disableRipple | ||
variant="contained" | ||
onClick={handleOpenDeleteDialog} | ||
sx={{ |
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.
Implement the account deletion logic
While the DeleteAccountConfirmation
modal triggers the confirmation dialog, ensure that the actual account deletion logic is implemented and securely handles user data removal.
Consider adding an onConfirm
prop to the DeleteAccountConfirmation
component to handle the deletion action. Ensure this action includes necessary error handling and user feedback.
<DeleteAccountConfirmation | ||
open={isDeleteDialogOpen} | ||
onClose={handleCloseDeleteDialog} | ||
/> |
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.
🛠️ Refactor suggestion
Pass the account deletion handler to DeleteAccountConfirmation
To execute the account deletion when the user confirms, pass an onConfirm
handler to the DeleteAccountConfirmation
component.
Apply this diff to pass the handler:
<DeleteAccountConfirmation
open={isDeleteDialogOpen}
onClose={handleCloseDeleteDialog}
+ onConfirm={handleDeleteAccount}
"
/>
Then, define handleDeleteAccount
in your component:
const handleDeleteAccount = () => {
// Implement account deletion logic here
};
// State hooks for managing form inputs and profile photo. | ||
const [firstname, setFirstname] = useState(""); // State for the first name field. | ||
const [lastname, setLastname] = useState(""); // State for the last name field. | ||
const [password, setPassword] = useState(""); // State for the email/password field (misnamed, should represent email). |
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.
Rename password
state variable to email
for clarity
The state variable password
is being used to store the user's email address, as indicated by its usage in the email field. To improve code readability and maintain consistency, consider renaming it to email
.
Apply this diff to rename the variable:
-const [password, setPassword] = useState(""); // State for the email/password field (misnamed, should represent email).
+const [email, setEmail] = useState(""); // State for the email field.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const [password, setPassword] = useState(""); // State for the email/password field (misnamed, should represent email). | |
const [email, setEmail] = useState(""); // State for the email field. |
const handleDeletePhoto = () => { | ||
setProfilePhoto("/placeholder.svg?height=80&width=80"); | ||
console.log("Photo deleted"); | ||
}; |
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.
🛠️ Refactor suggestion
Remove unnecessary console.log
statement
The console.log("Photo deleted");
statement in handleDeletePhoto
may not be necessary in production code and could clutter the console. Consider removing it or replacing it with user feedback that is visible in the UI.
Apply this diff to remove the console log:
const handleDeletePhoto = () => {
setProfilePhoto("/placeholder.svg?height=80&width=80");
- console.log("Photo deleted");
};
Alternatively, to provide user feedback, you might implement a snackbar or notification:
+// Optional: Provide user feedback
+enqueueSnackbar('Profile photo deleted', { variant: 'info' });
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const handleDeletePhoto = () => { | |
setProfilePhoto("/placeholder.svg?height=80&width=80"); | |
console.log("Photo deleted"); | |
}; | |
const handleDeletePhoto = () => { | |
setProfilePhoto("/placeholder.svg?height=80&width=80"); | |
}; |
onClick={handleDeletePhoto} | ||
> | ||
Delete | ||
</Typography> |
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.
🛠️ Refactor suggestion
Use Button
component instead of Typography
for clickable text
The "Delete" text functions as a clickable element but is implemented using Typography
. For better semantics and accessibility, consider using the Button
component styled to appear as text.
Apply this diff to use a Button
:
-<Typography
- sx={{
- color: "#667085",
- cursor: "pointer",
- textDecoration: "none",
- "&:hover": { textDecoration: "underline" },
- }}
- onClick={handleDeletePhoto}
->
- Delete
-</Typography>
+<Button
+ onClick={handleDeletePhoto}
+ sx={{
+ color: "#667085",
+ backgroundColor: "transparent",
+ textTransform: "none",
+ padding: 0,
+ minWidth: 0,
+ '&:hover': { backgroundColor: "transparent", textDecoration: "underline" },
+ }}
+>
+ Delete
+</Button>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
onClick={handleDeletePhoto} | |
> | |
Delete | |
</Typography> | |
<Button | |
onClick={handleDeletePhoto} | |
sx={{ | |
color: "#667085", | |
backgroundColor: "transparent", | |
textTransform: "none", | |
padding: 0, | |
minWidth: 0, | |
'&:hover': { backgroundColor: "transparent", textDecoration: "underline" }, | |
}} | |
> | |
Delete | |
</Button> |
@melpsh Screenshots please. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
Clients/src/presentation/pages/SettingsPage/index.tsx (1)
Line range hint
1-46
: Consider potential improvements for code organizationThe component is well-implemented, but consider the following suggestions for improved code organization and reusability:
- Extract the tab configuration into a separate constant or configuration object. This would make it easier to add, remove, or modify tabs in the future.
- Consider using a switch statement or object literal for rendering tab content instead of multiple conditional renders. This approach scales better if more tabs are added in the future.
Here's an example of how you could implement these suggestions:
const TABS = [ { label: "Profile", component: Profile }, { label: "Password", component: Password }, { label: "Team", component: Team }, ]; // In the render method: {TABS.map(({ label, component: Component }, index) => ( <React.Fragment key={label}> <Tab label={label} /> {activeTab === index && <Component />} </React.Fragment> ))}These changes would make the component more maintainable and easier to extend in the future.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (1 hunks)
- Clients/src/presentation/pages/SettingsPage/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx
🧰 Additional context used
🔇 Additional comments (1)
Clients/src/presentation/pages/SettingsPage/index.tsx (1)
35-35
: LGTM: Tab label updated to "Profile"The change from "Users" to "Profile" for the first tab label is appropriate and aligns with the component's name (
ProfilePage
) and purpose. This update improves clarity for users navigating the settings page.
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (2)
20-38
: Great documentation, consider adding @returns description.The JSDoc comment is comprehensive and well-structured. It provides a clear description, usage example, and parameter details.
Consider adding a description for the @returns tag to complete the documentation:
* @returns {JSX.Element} A Dialog component for account deletion confirmation and a conditional success banner.
57-85
: LGTM: Dialog component is well-structured. Consider improving accessibility.The Dialog component is correctly implemented with appropriate content and actions.
To improve accessibility, consider adding more descriptive aria labels:
- aria-labelledby="alert-dialog-title" - aria-describedby="alert-dialog-description" + aria-labelledby="delete-account-dialog-title" + aria-describedby="delete-account-dialog-description"And update the corresponding IDs:
- <DialogTitle id="alert-dialog-title"> + <DialogTitle id="delete-account-dialog-title">- <DialogContentText id="alert-dialog-description"> + <DialogContentText id="delete-account-dialog-description">
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (2)
1-18
: LGTM: Imports and interface declaration are well-structured.The necessary components are imported, and the
DeleteAccountConfirmationProps
interface is correctly defined with the required props.
39-55
:⚠️ Potential issueImplement actual account deletion in handleDeleteAccount function.
The current implementation only manages UI state without performing the actual account deletion.
As mentioned in a previous review, consider updating the function to integrate with your backend API:
const handleDeleteAccount = async () => { try { await deleteAccount(); // Call your API function here setIsBannerOpen(true); onClose(); setTimeout(() => setIsBannerOpen(false), 3000); } catch (error) { console.error("Failed to delete account:", error); // Handle error (e.g., show an error message to the user) } };Also, consider adding error handling and user feedback for failed deletion attempts.
{/* Conditionally render banner when isBannerOpen is true */} | ||
{isBannerOpen && ( | ||
<Box | ||
sx={{ | ||
position: "fixed", | ||
bottom: 16, | ||
right: 16, | ||
zIndex: 1000, | ||
}} | ||
> | ||
<Paper | ||
sx={{ | ||
width: "219px", | ||
height: "52px", | ||
display: "flex", // Flexbox layout | ||
justifyContent: "space-between", // Space between text and CloseIcon | ||
alignItems: "center", // Vertically center the content | ||
padding: "0 16px", // Add some padding to the sides | ||
color: "#475467", | ||
overflow: "visible", | ||
}} | ||
> | ||
<Typography | ||
sx={{ | ||
fontSize: "13px", | ||
color: "#475467", | ||
whiteSpace: "nowrap", // Prevent text from wrapping | ||
}} | ||
> | ||
This account is removed. | ||
<CloseIcon | ||
onClick={onClose} | ||
style={{ cursor: "pointer", marginLeft: 14}} | ||
/> | ||
</Typography> | ||
</Paper> | ||
</Box> | ||
)} | ||
</> | ||
); | ||
}; |
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.
Refactor success banner to match the provided design.
The current implementation of the success banner has some issues and doesn't match the design provided in the PR comments.
Please consider the following improvements:
- Move the CloseIcon outside of the Typography component for better structure.
- Use theme spacing and relative units instead of fixed pixel values for better responsiveness.
- Update the styling to match the provided design, including the green background and white text.
Here's a suggested refactor:
{isBannerOpen && (
<Box
sx={{
position: "fixed",
bottom: (theme) => theme.spacing(2),
right: (theme) => theme.spacing(2),
zIndex: 1000,
}}
>
<Paper
sx={{
display: "flex",
alignItems: "center",
padding: (theme) => theme.spacing(1, 2),
backgroundColor: "#12B76A", // Green background as per design
color: "#FFFFFF", // White text as per design
borderRadius: (theme) => theme.shape.borderRadius,
}}
>
<Typography variant="body2" sx={{ marginRight: (theme) => theme.spacing(1) }}>
This account is removed.
</Typography>
<CloseIcon
onClick={() => setIsBannerOpen(false)}
sx={{ cursor: "pointer", fontSize: "small" }}
/>
</Paper>
</Box>
)}
This refactor addresses the structural issues and better matches the provided design. Adjust the colors and spacing as needed to perfectly match the design specifications.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (2)
20-38
: Great documentation, consider adding @returns description.The JSDoc comment is comprehensive and well-structured. It provides a clear description, usage example, and parameter explanations.
Consider adding a description for the @returns tag to complete the documentation:
* @returns {JSX.Element} A Dialog component for confirming account deletion, with a conditional success banner.
57-96
: Dialog implementation looks good, consider using theme spacing.The Dialog component is well-structured and includes the necessary content and actions. The custom styling helps achieve the desired layout.
Consider using theme spacing instead of fixed pixel values for better consistency and maintainability:
PaperProps={{ sx: (theme) => ({ width: theme.spacing(54.875), // 439px height: theme.spacing(30), // 240px maxWidth: "none", padding: theme.spacing(4), overflowY: "hidden" }), }}Apply similar changes to other fixed pixel values throughout the component.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (4)
1-18
: LGTM: Imports and interface declaration are well-structured.The necessary imports are included, and the
DeleteAccountConfirmationProps
interface is correctly defined with the required props.
39-55
: Implement actual delete functionality inhandleDeleteAccount
.The current implementation only manages the banner visibility and closes the dialog. For a production environment, this function should integrate with your backend API to perform the actual account deletion.
Consider updating the function to include the actual deletion logic:
const handleDeleteAccount = async () => { try { await deleteAccount(); // Call your API function here setIsBannerOpen(true); onClose(); setTimeout(() => setIsBannerOpen(false), 3000); } catch (error) { console.error("Failed to delete account:", error); // Handle error (e.g., show an error message to the user) } };
98-133
: Refactor success banner to match the provided design.The current implementation of the success banner has some issues and doesn't match the design provided in the PR comments.
Please consider the following improvements:
- Move the CloseIcon outside of the Typography component for better structure.
- Use theme spacing and relative units instead of fixed pixel values for better responsiveness.
- Update the styling to match the provided design, including the green background and white text.
Here's a suggested refactor:
{isBannerOpen && ( <Box sx={{ position: "fixed", bottom: (theme) => theme.spacing(2), right: (theme) => theme.spacing(2), zIndex: 1000, }} > <Paper sx={{ display: "flex", alignItems: "center", padding: (theme) => theme.spacing(1, 2), backgroundColor: "#12B76A", // Green background as per design color: "#FFFFFF", // White text as per design borderRadius: (theme) => theme.shape.borderRadius, }} > <Typography variant="body2" sx={{ marginRight: (theme) => theme.spacing(1) }}> This account is removed. </Typography> <CloseIcon onClick={() => setIsBannerOpen(false)} sx={{ cursor: "pointer", fontSize: "small" }} /> </Paper> </Box> )}This refactor addresses the structural issues and better matches the provided design. Adjust the colors and spacing as needed to perfectly match the design specifications.
1-138
: Overall, good implementation with room for improvement.The DeleteAccountConfirmation component is well-structured and functional. However, there are a few areas that need attention:
- Implement actual account deletion functionality in the
handleDeleteAccount
function.- Use theme spacing consistently throughout the component for better maintainability.
- Refactor the success banner to match the provided design specifications.
Addressing these points will significantly improve the component's functionality and alignment with the design requirements.
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (3)
Clients/src/presentation/components/Modals/Banner/index.tsx (3)
4-8
: Interface definition is well-structured.The
IBannerProps
interface clearly defines the expected props for the component. For consistency with TypeScript naming conventions, consider usingBannerProps
instead ofIBannerProps
.-interface IBannerProps{ +interface BannerProps { onClose: ()=> void; bannerText: string, bannerWidth: string }
10-10
: Consider renaming the component for clarity.Instead of naming the component
index
, consider giving it a more descriptive name likeBanner
orNotificationBanner
. This improves code readability and maintainability.-const index = ({onClose, bannerText, bannerWidth}: IBannerProps) => { +const Banner = ({onClose, bannerText, bannerWidth}: BannerProps) => {
52-52
: Update export statement if component is renamed.If you rename the component as suggested earlier, don't forget to update the export statement accordingly.
-export default index; +export default Banner;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- Clients/src/presentation/components/Modals/Banner/index.tsx (1 hunks)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- Clients/src/presentation/components/Modals/DeleteAccount/index.tsx
🧰 Additional context used
🔇 Additional comments (2)
Clients/src/presentation/components/Modals/Banner/index.tsx (2)
1-2
: Imports look good!The necessary Material-UI components and icons are correctly imported.
1-52
: Verify implementation against design specifications.The Banner component seems to be implemented correctly and functions as expected. However, please ensure that it aligns with the design specifications provided in the PR comments, particularly regarding gaps and spacings. Consider the following:
- Verify the banner's position (bottom right, 16px from edges) matches the Figma design.
- Check if the height (52px) and other dimensions are consistent with the specifications.
- Ensure the typography styles (font size, color) match the design.
- Confirm that the close icon's size and positioning are correct.
It might be helpful to compare your implementation with the sample popup image provided by gorkem-bwl in the PR comments.
<Box | ||
sx={{ | ||
position: "fixed", | ||
bottom: 16, | ||
right: 16, | ||
zIndex: 1000, | ||
}} | ||
> | ||
<Paper | ||
sx={{ | ||
width: {bannerWidth}, | ||
height: "52px", | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
color: "#475467", | ||
}} | ||
> | ||
<Typography | ||
sx={{ | ||
fontSize: "13px", | ||
color: "#475467", | ||
whiteSpace: "nowrap", | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
paddingLeft: '7px' | ||
}} | ||
> | ||
{bannerText} | ||
<CloseIcon | ||
onClick={onClose} | ||
style={{ cursor: "pointer", marginLeft: '8px' , marginRight: '8px' }} | ||
/> | ||
</Typography> | ||
</Paper> | ||
</Box> | ||
); |
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.
🛠️ Refactor suggestion
Consider extracting styles for better maintainability.
The component uses inline styles extensively. While this works, it can make the component harder to maintain as it grows. Consider extracting these styles into a separate constant or using a CSS-in-JS solution for better organization.
Here's an example of how you could extract the styles:
const styles = {
container: {
position: "fixed",
bottom: 16,
right: 16,
zIndex: 1000,
},
paper: {
height: "52px",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
color: "#475467",
},
typography: {
fontSize: "13px",
color: "#475467",
whiteSpace: "nowrap",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
paddingLeft: '7px'
},
closeIcon: {
cursor: "pointer",
marginLeft: '8px',
marginRight: '8px'
}
};
// Then in your JSX:
<Box sx={styles.container}>
<Paper sx={{...styles.paper, width: bannerWidth}}>
<Typography sx={styles.typography}>
{bannerText}
<CloseIcon onClick={onClose} style={styles.closeIcon} />
</Typography>
</Paper>
</Box>
> | ||
<Paper | ||
sx={{ | ||
width: {bannerWidth}, |
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.
Fix syntax error in width property.
There's a syntax error in setting the width
property of the Paper
component. The curly braces around bannerWidth
are unnecessary in this context.
- width: {bannerWidth},
+ width: bannerWidth,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
width: {bannerWidth}, | |
width: bannerWidth, |
Summary by CodeRabbit
New Features
Bug Fixes