Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Dec 8, 2023
1 parent 97b32d4 commit 743e3d1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 51 deletions.
6 changes: 3 additions & 3 deletions src/components/TopBar/AboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
} from '@mui/icons-material';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import LogoTextOnly from './LogoTextOnly';
import { LogoText } from './GridLogo';

const moduleTypeSort = {
app: 1,
Expand Down Expand Up @@ -186,7 +186,7 @@ const AboutDialog = ({
justifyContent: 'center',
}}
>
<LogoTextOnly
<LogoText
appName="Suite"
appColor={theme.palette.grey['500']}
/>
Expand Down Expand Up @@ -380,7 +380,7 @@ const Module = ({ type, name, version, license }) => {
<Stack
direction="row"
justifyContent="flex-start"
alignItems="flex-start"
alignItems="baseline"
spacing={1}
>
{ModuleTypesIcons[type] || ModuleTypesIcons['other']}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
*/

import React from 'react';
import { Box } from '@mui/material';
import { Box, Typography } from '@mui/material';
import { BrokenImage } from '@mui/icons-material';
import { mergeSx } from '../../utils/styles';
import PropTypes from 'prop-types';
import LogoTextOnly from './LogoTextOnly';

const styles = {
logo: {
Expand All @@ -27,7 +26,7 @@ const styles = {
},
};

const LogoWithText = ({ appLogo, appName, appColor, onClick }) => {
const GridLogo = ({ appLogo, appName, appColor, onClick }) => {
return (
<>
<Box
Expand All @@ -36,7 +35,7 @@ const LogoWithText = ({ appLogo, appName, appColor, onClick }) => {
>
{appLogo || <BrokenImage />}
</Box>
<LogoTextOnly
<LogoText
appName={appName}
appColor={appColor}
onClick={onClick}
Expand All @@ -46,11 +45,31 @@ const LogoWithText = ({ appLogo, appName, appColor, onClick }) => {
);
};

export default LogoWithText;
export default GridLogo;

LogoWithText.propTypes = {
GridLogo.propTypes = {
appLogo: PropTypes.element,
appName: PropTypes.string.isRequired,
appColor: PropTypes.string.isRequired,
onClick: PropTypes.func,
};

export const LogoText = ({ appName, appColor, style, onClick }) => {
return (
<Typography
variant="h4"
sx={mergeSx(style, onClick && styles.clickable)}
onClick={onClick}
>
<span style={{ fontWeight: 'bold' }}>Grid</span>
<span style={{ color: appColor }}>{appName}</span>
</Typography>
);
};

LogoText.propTypes = {
appName: PropTypes.string.isRequired,
appColor: PropTypes.string.isRequired,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
onClick: PropTypes.func,
};
39 changes: 0 additions & 39 deletions src/components/TopBar/LogoTextOnly.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import PropTypes from 'prop-types';
import FullScreen, { fullScreenSupported } from 'react-request-fullscreen';

import ElementSearchDialog from '../ElementSearchDialog';
import LogoWithText from './LogoWithText';
import GridLogo from './GridLogo';
import AboutDialog from './AboutDialog';

const styles = {
Expand Down Expand Up @@ -286,7 +286,7 @@ const TopBar = ({

const logo_clickable = useMemo(
() => (
<LogoWithText
<GridLogo
onClick={onLogoClick}
appLogo={appLogo}
appName={appName}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TopBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
export { default } from './TopBar';
export { default as LogoWithText } from './LogoWithText';
export * from './GridLogo';
export { default as AboutDialog } from './AboutDialog';

0 comments on commit 743e3d1

Please sign in to comment.