File tree Expand file tree Collapse file tree 6 files changed +58
-23
lines changed
react-kit/src/lib/components Expand file tree Collapse file tree 6 files changed +58
-23
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export default function Home() {
99 < Link to = "/dialog" > Dialog</ Link > < br />
1010 < Link to = "/circular-progress" > Circular Progress</ Link > < br />
1111 < Link to = "/books" > All Books</ Link > < br />
12+ < Link to = "/react-if" > React If Demo</ Link > < br />
13+ < Link to = "/links" > Links Demo</ Link > < br />
1214 </ ul >
1315 </ div >
1416 ) ;
Original file line number Diff line number Diff line change 11import { Link , Outlet } from 'react-router-dom' ;
2- import React from 'react' ;
32
43export default function App ( ) {
54 return (
@@ -13,6 +12,7 @@ export default function App() {
1312 < Link to = "/circular-progress" > Circular Progress</ Link > < br />
1413 < Link to = "/books" > All Books</ Link > < br />
1514 < Link to = "/react-if" > React If Demo</ Link > < br />
15+ < Link to = "/links" > Links Demo</ Link > < br />
1616 </ ul >
1717 </ div >
1818
Original file line number Diff line number Diff line change 1+ import { Divider } from "@mui/material" ;
2+ import { NextLink , OpenInNewIconLink } from "@react-kit/*" ;
3+
4+
5+ export default function LinksDemo ( ) {
6+ return (
7+ < div >
8+ < div style = { { marginInline : '1rem' , textAlign : 'center' } } >
9+ < h2 > Links Demo</ h2 >
10+ < Divider sx = { { mb : 3 } } />
11+ MUI Link:
12+ < NextLink href = { "/buttons-demo" } > Buttons Demo</ NextLink >
13+ < br />
14+ Open In New Icon Link :
15+ < OpenInNewIconLink href = { `https://www.google.com/` } target = "_blank" linkText = { 'Open In New Tab' } />
16+ < br />
17+ </ div >
18+ </ div >
19+ ) ;
20+ }
Original file line number Diff line number Diff line change 11import { createBrowserRouter } from 'react-router-dom' ;
22import Home from '../app/Home' ;
3+ import AllBooks from '../app/all-books/AllBooks' ;
4+ import App from '../app/app' ;
35import ButtonsDemo from '../app/buttons/ButtonsDemo' ;
4- import SnackBarDemo from '../app/snack-bar/SnackBarDemo' ;
56import DialogDemo from '../app/dialog/DialogDemo' ;
7+ import LinksDemo from '../app/links/LinksDemo' ;
68import CenterCircularProgressDemo from '../app/progress-bar/CenterCircularProgressDemo' ;
7- import AllBooks from '../app/all-books/AllBooks' ;
8- import App from '../app/app' ;
99import ReactIfDemo from '../app/react-if/ReactIfDemo' ;
10+ import SnackBarDemo from '../app/snack-bar/SnackBarDemo' ;
1011
1112export const router = createBrowserRouter ( [
1213 {
@@ -45,6 +46,10 @@ export const router = createBrowserRouter([
4546 path : '/react-if' ,
4647 element : < ReactIfDemo /> ,
4748 } ,
49+ {
50+ path : '/links' ,
51+ element : < LinksDemo /> ,
52+ } ,
4853 ] ,
4954 } ,
5055] ) ;
Original file line number Diff line number Diff line change 3434 font-size : 20px ;
3535 display : block ;
3636}
37-
Original file line number Diff line number Diff line change 1- import React from 'react' ;
2- import { Icon } from '@mui/material' ;
31import OpenInNewIcon from '@mui/icons-material/OpenInNew' ;
2+ import { Icon , Link as MuiLink } from '@mui/material' ;
3+ import React from 'react' ;
4+ import { Link } from 'react-router-dom' ;
45
56interface OpenInNewIconLinkProps {
6- href : string ;
7- linkText : string ;
8- target : string ;
9- children ?: React . ReactNode ;
7+ href : string ;
8+ linkText : string ;
9+ target : string ;
10+ children ?: React . ReactNode ;
1011}
1112
1213/**
@@ -18,16 +19,24 @@ interface OpenInNewIconLinkProps {
1819 * @since 1.2.24
1920 */
2021export function OpenInNewIconLink ( props : OpenInNewIconLinkProps ) {
21- return (
22- < a
23- href = { props . href }
24- target = { '_blank' }
25- rel = "noreferrer"
26- style = { { display : 'flex' , alignItems : 'center' } }
27- >
28- { props . linkText }
29- < Icon sx = { { fontSize : '1.1rem' , mx : 0.75 } } component = { OpenInNewIcon } />
30- { props . children }
31- </ a >
32- ) ;
22+ return (
23+ < MuiLink
24+ component = { Link }
25+ to = { props . href }
26+ target = { props . target || '_blank' }
27+ rel = "noreferrer"
28+ className = { 'next-btn-link' }
29+ underline = "hover" >
30+ { props . linkText ?? props . children }
31+ < Icon
32+ sx = { {
33+ fontSize : '1.1rem' ,
34+ mx : 0.75 ,
35+ verticalAlign : 'middle' ,
36+ display : 'inline-flex' ,
37+ } }
38+ component = { OpenInNewIcon }
39+ />
40+ </ MuiLink >
41+ ) ;
3342}
You can’t perform that action at this time.
0 commit comments