Skip to content

Commit 7c56906

Browse files
committed
refactor: standardize props interface usage in NextLink, OpenInNewIconLink, and EditIconButton components
1 parent f3c0e8b commit 7c56906

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.github/copilot-instructions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
1. Always use latest React 19 version and TypeScript for our ReactJS development. Always show examples and reference the latest version of React in your responses. If in doubt, use docs from https://react.dev/learn
2+
2. Always use React router, MUI latest compoenents for React development
3+
3. Always use functional components and hooks for state management in React
4+
4. Always use TypeScript for type safety in React components
5+
5. Always use the latest best practices for performance optimization in React, such as memoization and lazy loading
6+
6. Always ensure accessibility standards are met in React components
7+
7. Always use ESLint and Prettier for code formatting and linting in React projects
8+
8. Always provide clear and concise comments in the code to explain complex logic or important decisions
9+
9. Always use PropTypes or TypeScript interfaces for defining component props
10+
10. Always ensure that components are reusable and modular, following the DRY (Don't Repeat Yourself) principle
11+

react-kit/src/lib/components/NextLink.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import React from 'react';
22
import { Link as MuiLink } from '@mui/material';
33
import { Link } from 'react-router-dom';
44

5+
interface Props {
6+
href: string;
7+
linkText?: string;
8+
target?: string;
9+
children?: React.ReactNode;
10+
}
11+
512
/**
613
* Reusable custom Next.js 13 Link component.
714
*
@@ -10,7 +17,7 @@ import { Link } from 'react-router-dom';
1017
* @author Pavan Kumar Jadda
1118
* @since 0.3.2
1219
*/
13-
export function NextLink(props: { href: string; linkText?: string; target?: string; children?: React.ReactNode }): React.JSX.Element {
20+
export function NextLink(props: Readonly<Props>): React.JSX.Element {
1421
return (
1522
<MuiLink component={Link} to={props.href} className={'next-btn-link'} underline="hover">
1623
{props.linkText ?? props.children}

react-kit/src/lib/components/OpenInNewIconLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Icon, Link as MuiLink } from '@mui/material';
33
import React from 'react';
44
import { Link } from 'react-router-dom';
55

6-
interface OpenInNewIconLinkProps {
6+
interface Props {
77
href: string;
88
linkText: string;
99
target: string;
@@ -18,7 +18,7 @@ interface OpenInNewIconLinkProps {
1818
* @author Pavan Kumar Jadda
1919
* @since 1.2.24
2020
*/
21-
export function OpenInNewIconLink(props: OpenInNewIconLinkProps) {
21+
export function OpenInNewIconLink(props: Readonly<Props>) {
2222
return (
2323
<MuiLink
2424
component={Link}

react-kit/src/lib/components/buttons/EditIconButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface EditIconButtonProps {
88
color?: 'inherit' | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
99
}
1010

11-
export function EditIconButton(props: EditIconButtonProps) {
11+
export function EditIconButton(props: Readonly<EditIconButtonProps>) {
1212
return (
1313
<Tooltip title={props.tooltipTitle}>
1414
<IconButton

0 commit comments

Comments
 (0)