-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Link component with the updated structure and props resolves #43 Signed-off-by: Niloy Sikdar <niloysikdar30@gmail.com>
- Loading branch information
1 parent
b596221
commit 608cbb7
Showing
4 changed files
with
42 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Button } from './Button'; | ||
export { Button, ButtonProps } from './Button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import { ReactNode, CSSProperties } from 'react'; | ||
import { ReactNode, HTMLAttributeAnchorTarget } from 'react'; | ||
import { BaseStyleProp } from '../types'; | ||
import { makeStyles } from '../../utils/makeStyles'; | ||
|
||
export interface LinkProps { | ||
type LinkStyles = 'root'; | ||
|
||
export interface LinkProps extends BaseStyleProp<LinkStyles> { | ||
children?: ReactNode; | ||
href: string; | ||
align?: 'left' | 'center' | 'right'; | ||
style?: CSSProperties; | ||
target?: HTMLAttributeAnchorTarget; | ||
} | ||
|
||
export const Link = ({ children, href, align = 'left', style }: LinkProps): JSX.Element => { | ||
const useStyles = makeStyles({ | ||
root: {}, | ||
}); | ||
|
||
export const Link = ({ | ||
children, | ||
href, | ||
target = '_blank', | ||
classes, | ||
className, | ||
}: LinkProps): JSX.Element => { | ||
const styles = useStyles({ classes }); | ||
|
||
return ( | ||
<td | ||
align={align} | ||
style={{ | ||
padding: '10px 20px', | ||
wordBreak: 'break-word', | ||
}} | ||
> | ||
<a | ||
href={href} | ||
target="_blank" | ||
style={{ | ||
fontSize: '18px', | ||
...style, | ||
}} | ||
> | ||
{children} | ||
</a> | ||
</td> | ||
<a href={href} target={target} style={styles.root} className={className}> | ||
{children} | ||
</a> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Link } from './Link'; | ||
export { Link, LinkProps } from './Link'; |