mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Refactoring components
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import Link from 'next/link';
|
||||
import styled from 'styled-components';
|
||||
import styled, { css } from 'styled-components';
|
||||
import { Props } from './types';
|
||||
|
||||
export const Btn = styled(Link)<Props>`
|
||||
export const sharedStyles = css<Props>`
|
||||
cursor: pointer;
|
||||
display: ${({ variant }) =>
|
||||
['action', 'outline'].includes(variant as string) ? 'block' : 'inline'};
|
||||
width: ${({ variant }) => (['action', 'outline'].includes(variant as string) ? '100%' : 'auto')};
|
||||
/* TODO: fix theme blue color problem */
|
||||
background: ${({ variant }) => (variant === 'action' ? '#1573CA' : 'none')};
|
||||
color: ${({ variant, mode }) =>
|
||||
variant === 'action' ? 'white' : mode === 'dark' ? 'white' : 'black'};
|
||||
@@ -25,9 +24,7 @@ export const Btn = styled(Link)<Props>`
|
||||
text-decoration: none;
|
||||
transition: color 250ms ease-in-out;
|
||||
|
||||
${({ disabled }) =>
|
||||
disabled &&
|
||||
`
|
||||
${({ disabled }) => disabled && `
|
||||
background: gray;
|
||||
cursor: default;
|
||||
`}
|
||||
@@ -37,3 +34,11 @@ export const Btn = styled(Link)<Props>`
|
||||
['action', 'outline'].includes(variant as string) ? '.5rem .75rem' : '0rem'};
|
||||
}
|
||||
`;
|
||||
|
||||
export const StyledLink = styled(Link)<Props>`
|
||||
${sharedStyles}
|
||||
`;
|
||||
|
||||
export const StyledButton = styled.button<Omit<Props, 'href'>>`
|
||||
${sharedStyles}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user