mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Complete button component
This commit is contained in:
+1
-13
@@ -1,6 +1,4 @@
|
|||||||
import { Route, Switch } from 'react-router-dom';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
import { Button } from './components';
|
|
||||||
// import { Add } from './assets';
|
|
||||||
import GlobalStyles from './GlobalStyles';
|
import GlobalStyles from './GlobalStyles';
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
@@ -9,17 +7,7 @@ const App = () => {
|
|||||||
<GlobalStyles />
|
<GlobalStyles />
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path='/' exact>
|
<Route path='/' exact>
|
||||||
<div style={{ margin: '2rem', width: '95vw' }}>
|
<div style={{ margin: '2rem', width: '95vw' }}></div>
|
||||||
<Button
|
|
||||||
color='client'
|
|
||||||
// size='big'
|
|
||||||
variant='outlined'
|
|
||||||
text='Button'
|
|
||||||
// fullWidth
|
|
||||||
// iconLeft={<Add />}
|
|
||||||
onClick={() => {}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M8.95215 1V14.8568" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
<path d="M8.95215 1V14.8568" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
<path d="M1 7.92871H16.9048" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
<path d="M1 7.92871H16.9048" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 323 B |
@@ -31,9 +31,9 @@ const Button = ({
|
|||||||
fullWidth={fullWidth}
|
fullWidth={fullWidth}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{iconLeft && iconLeft}
|
{iconLeft && <span className='icon left'>{iconLeft}</span>}
|
||||||
{text}
|
{text}
|
||||||
{iconRight && iconRight}
|
{iconRight && <span className='icon right'>{iconRight}</span>}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,22 +17,61 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
background: none;
|
background: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
.icon svg {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
${({ iconLeft, iconRight }) => {
|
||||||
|
if (iconLeft || iconRight)
|
||||||
|
return css`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`;
|
||||||
|
return '';
|
||||||
|
}}
|
||||||
|
|
||||||
|
.icon.left {
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon.right {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
${({ size }) => {
|
${({ size }) => {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 'small':
|
case 'small':
|
||||||
return css`
|
return css`
|
||||||
padding: 0.625rem 1.875rem;
|
padding: 0.625rem 1.875rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
|
||||||
|
.icon svg {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
case 'big':
|
case 'big':
|
||||||
return css`
|
return css`
|
||||||
padding: 0.625rem 1.875rem;
|
padding: 0.625rem 1.875rem;
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
|
|
||||||
|
.icon svg {
|
||||||
|
width: 1.25rem;
|
||||||
|
height: 1.25rem;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
default:
|
default:
|
||||||
return css`
|
return css`
|
||||||
padding: 0.625rem 1.875rem;
|
padding: 0.625rem 1.875rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
|
||||||
|
.icon svg {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -42,6 +81,11 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
css`
|
css`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
|
|
||||||
|
.icon svg {
|
||||||
|
width: 1.25rem;
|
||||||
|
height: 1.25rem;
|
||||||
|
}
|
||||||
`};
|
`};
|
||||||
|
|
||||||
${({ variant, color, theme }) => {
|
${({ variant, color, theme }) => {
|
||||||
@@ -51,6 +95,10 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
background: ${theme.colors[color].main};
|
background: ${theme.colors[color].main};
|
||||||
color: ${theme.colors.white.main};
|
color: ${theme.colors.white.main};
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors.white.main};
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${theme.colors[color].dark};
|
background: ${theme.colors[color].dark};
|
||||||
}
|
}
|
||||||
@@ -60,8 +108,16 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
background: ${theme.colors[color].light};
|
background: ${theme.colors[color].light};
|
||||||
color: #262628;
|
color: #262628;
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: #262628;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${theme.colors.white.main};
|
color: ${theme.colors.white.main};
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors.white.main};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
case 'outlined':
|
case 'outlined':
|
||||||
@@ -70,9 +126,17 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
color: ${theme.colors[color].main};
|
color: ${theme.colors[color].main};
|
||||||
border: 2px solid ${theme.colors[color].main};
|
border: 2px solid ${theme.colors[color].main};
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors[color].main};
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${theme.colors[color].main};
|
background: ${theme.colors[color].main};
|
||||||
color: ${theme.colors.white.main};
|
color: ${theme.colors.white.main};
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors.white.main};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
case 'text':
|
case 'text':
|
||||||
@@ -80,12 +144,20 @@ export const Wrapper = styled.button<WrapperProps>`
|
|||||||
background: none;
|
background: none;
|
||||||
color: ${theme.colors[color].main};
|
color: ${theme.colors[color].main};
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors[color].main};
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
default:
|
default:
|
||||||
return css`
|
return css`
|
||||||
background: none;
|
background: none;
|
||||||
color: ${theme.colors[color].main};
|
color: ${theme.colors[color].main};
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
.icon svg path {
|
||||||
|
stroke: ${theme.colors[color].main};
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user