Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/react-kit-demo/src/app/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default function Home() {
<Link to="/dialog">Dialog</Link> <br />
<Link to="/circular-progress">Circular Progress</Link> <br />
<Link to="/books">All Books</Link> <br />
<Link to="/react-if">React If Demo</Link> <br />
<Link to="/links">Links Demo</Link> <br />
</ul>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/react-kit-demo/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Link, Outlet } from 'react-router-dom';
import React from 'react';

export default function App() {
return (
Expand All @@ -13,6 +12,7 @@ export default function App() {
<Link to="/circular-progress">Circular Progress</Link> <br />
<Link to="/books">All Books</Link> <br />
<Link to="/react-if">React If Demo</Link> <br />
<Link to="/links">Links Demo</Link> <br />
</ul>
</div>

Expand Down
20 changes: 20 additions & 0 deletions apps/react-kit-demo/src/app/links/LinksDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Divider } from "@mui/material";
import { NextLink, OpenInNewIconLink } from "@react-kit/*";


export default function LinksDemo() {
return (
<div>
<div style={{ marginInline: '1rem', textAlign: 'center' }}>
<h2>Links Demo</h2>
<Divider sx={{ mb: 3 }} />
MUI Link:
<NextLink href={"/buttons-demo"}> Buttons Demo</NextLink>
<br />
Open In New Icon Link :
<OpenInNewIconLink href={`https://www.google.com/`} target="_blank" linkText={'Open In New Tab'} />
<br />
</div>
</div>
);
}
11 changes: 8 additions & 3 deletions apps/react-kit-demo/src/routes/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createBrowserRouter } from 'react-router-dom';
import Home from '../app/Home';
import AllBooks from '../app/all-books/AllBooks';
import App from '../app/app';
import ButtonsDemo from '../app/buttons/ButtonsDemo';
import SnackBarDemo from '../app/snack-bar/SnackBarDemo';
import DialogDemo from '../app/dialog/DialogDemo';
import LinksDemo from '../app/links/LinksDemo';
import CenterCircularProgressDemo from '../app/progress-bar/CenterCircularProgressDemo';
import AllBooks from '../app/all-books/AllBooks';
import App from '../app/app';
import ReactIfDemo from '../app/react-if/ReactIfDemo';
import SnackBarDemo from '../app/snack-bar/SnackBarDemo';

export const router = createBrowserRouter([
{
Expand Down Expand Up @@ -45,6 +46,10 @@ export const router = createBrowserRouter([
path: '/react-if',
element: <ReactIfDemo />,
},
{
path: '/links',
element: <LinksDemo />,
},
],
},
]);
1 change: 0 additions & 1 deletion apps/react-kit-demo/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
font-size: 20px;
display: block;
}

45 changes: 27 additions & 18 deletions react-kit/src/lib/components/OpenInNewIconLink.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { Icon } from '@mui/material';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import { Icon, Link as MuiLink } from '@mui/material';
import React from 'react';
import { Link } from 'react-router-dom';

interface OpenInNewIconLinkProps {
href: string;
linkText: string;
target: string;
children?: React.ReactNode;
href: string;
linkText: string;
target: string;
children?: React.ReactNode;
}

/**
Expand All @@ -18,16 +19,24 @@ interface OpenInNewIconLinkProps {
* @since 1.2.24
*/
export function OpenInNewIconLink(props: OpenInNewIconLinkProps) {
return (
<a
href={props.href}
target={'_blank'}
rel="noreferrer"
style={{ display: 'flex', alignItems: 'center' }}
>
{props.linkText}
<Icon sx={{ fontSize: '1.1rem', mx: 0.75 }} component={OpenInNewIcon} />
{props.children}
</a>
);
return (
<MuiLink
component={Link}
to={props.href}
target={props.target || '_blank'}
rel="noreferrer"
className={'next-btn-link'}
underline="hover">
{props.linkText ?? props.children}
<Icon
sx={{
fontSize: '1.1rem',
mx: 0.75,
verticalAlign: 'middle',
display: 'inline-flex',
}}
component={OpenInNewIcon}
/>
</MuiLink>
);
}