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

feat: added commitlint #222

Merged
merged 14 commits into from
Jun 26, 2024
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx lint-staged && npm run build
21 changes: 21 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'ci',
'chore',
'docs',
'ticket',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
],
],
},
};
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
"prepare": "husky"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
Expand Down Expand Up @@ -63,6 +68,8 @@
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^12.20.55",
"@types/react": "^18.0.10",
Expand Down
2 changes: 1 addition & 1 deletion src/components/message-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1214,4 +1214,4 @@ const MessageItem: FC<MessageItemPropType> = ({ message }) => {
}
};

export default MessageItem;
export default MessageItem;
94 changes: 48 additions & 46 deletions src/components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useLocalization } from '../../hooks';
import toast from 'react-hot-toast';
import { useColorPalates } from '../../providers/theme-provider/hooks';
import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace';

import Image from 'next/image';
const Navbar: React.FC = () => {
const router = useRouter();
const config = useConfig('component', 'navbar');
Expand Down Expand Up @@ -198,52 +198,54 @@ const Navbar: React.FC = () => {
)}
</div>

<div
style={{
position: 'absolute',
left: '50%',
transform: 'translateX(-50%)',
textAlign: 'center',
// marginTop: '20px',
}}
>
{showCenterLogo && (
<div>
<img
data-testid="navbar-center-img"
src={centerLogoSrc}
alt="Center Logo"
style={{ maxHeight: centerLogoSize }}
/>
</div>
)}
</div>
<div
style={{
position: 'absolute',
left: '50%',
transform: 'translateX(-50%)',
textAlign: 'center',
// marginTop: '20px',
}}
>
{showCenterLogo && (
<div>
<img
data-testid="navbar-center-img"
src={centerLogoSrc}
alt="Center Logo"
style={{ maxHeight: centerLogoSize }}
/>
</div>
)}
</div>

<div data-testid="navbar-right-logos">
{showRightLogo1 && (
<img
src={rightLogo1Src}
alt={`Right Logo 1`}
style={{ maxHeight: '60px' }}
/>
)}
{showRightLogo2 && (
<img
src={rightLogo2Src}
alt={`Right Logo 2`}
style={{ maxHeight: '60px' }}
/>
)}
{showRightLogo3 && (
<img
src={rightLogo3Src}
alt={`Right Logo 3`}
style={{ maxHeight: '60px' }}
/>
)}
</div>
</Toolbar>
</AppBar>

<div data-testid="navbar-right-logos">
{showRightLogo1 && (
<img
src={rightLogo1Src}
alt={`Right Logo 1`}
style={{ maxHeight: '60px' }}
/>
)}
{showRightLogo2 && (
<img
src={rightLogo2Src}
alt={`Right Logo 2`}
style={{ maxHeight: '60px' }}
/>
)}
{showRightLogo3 && (
<img
src={rightLogo3Src}
alt={`Right Logo 3`}
style={{ maxHeight: '60px' }}
/>
)}
</div>
</Toolbar>
</AppBar>


<Sidebar isOpen={isSidebarOpen} onToggle={toggleSidebar} />
</>
Expand Down