Skip to content

Commit

Permalink
refactor: RequiredAsterisk, Shadow & Slideup (thenewboston-blockchain…
Browse files Browse the repository at this point in the history
…#2095)

* RequiredAsterisk, Shadow & Slideup
  • Loading branch information
arialdyscv authored Oct 13, 2021
1 parent 727efa4 commit 722863c
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 66 deletions.
4 changes: 0 additions & 4 deletions src/components/RequiredAsterisk/RequiredAsterisk.scss

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/RequiredAsterisk/RequiredAsterisk.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ describe('RequiredAsterisk', () => {
expect(screen.getByText('*')).toBeTruthy();
});

it('renders proper default className', () => {
render(<RequiredAsterisk />);
const asterisk = screen.getByTestId('RequiredAsterisk');

expect(asterisk.className).toBe('RequiredAsterisk');
});

it('renders with passed in className', () => {
render(<RequiredAsterisk className="test" />);
const asterisk = screen.getByTestId('RequiredAsterisk');
Expand Down
7 changes: 7 additions & 0 deletions src/components/RequiredAsterisk/Style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components';
import colors from 'styles/colors';

export const RequiredAsterisk = styled.span`
color: ${colors.alert};
margin-left: 3px;
`;
8 changes: 3 additions & 5 deletions src/components/RequiredAsterisk/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React, {memo} from 'react';
import clsx from 'clsx';
import {SFC} from 'types/generic';

import './RequiredAsterisk.scss';
import * as S from './Style';

const RequiredAsterisk: SFC = ({className}) => {
return (
<span data-testid="RequiredAsterisk" className={clsx('RequiredAsterisk', className)}>
<S.RequiredAsterisk data-testid="RequiredAsterisk" className={className}>
*
</span>
</S.RequiredAsterisk>
);
};

Expand Down
6 changes: 0 additions & 6 deletions src/components/Shadow/Shadow.scss

This file was deleted.

9 changes: 9 additions & 0 deletions src/components/Shadow/Style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from 'styled-components';
import colors from 'styles/colors';

export const Shadow = styled.div`
background: ${colors.palette.gray['005']};
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
height: 1px;
width: 100vw;
`;
6 changes: 2 additions & 4 deletions src/components/Shadow/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import clsx from 'clsx';
import {SFC} from 'types/generic';
import * as S from './Style';

import './Shadow.scss';

const Shadow: SFC = ({className}) => <div className={clsx('Shadow', className)} />;
const Shadow: SFC = ({className}) => <S.Shadow className={className} />;

export default Shadow;
33 changes: 0 additions & 33 deletions src/components/SlideUp/SlideUp.scss

This file was deleted.

36 changes: 36 additions & 0 deletions src/components/SlideUp/Style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled, {keyframes} from 'styled-components';
import zIndex from 'styles/zIndex';
import colors from 'styles/colors';

export const SlideUp = styled.div`
bottom: 0;
position: absolute;
width: 100vw;
z-index: ${zIndex.slideup};
`;

export const SlideUpContent = styled.div`
background: ${colors.white};
box-shadow: 0px -3px 12px rgba(4, 34, 53, 0.25);
padding: 24px 30px 40px;
`;

const addOverlay = keyframes`
from {
background: rgba(0, 0, 0, 0);
}
to {
background: rgba(0, 0, 0, 0.3);
}
}
`;

export const SlideUpOverlay = styled.div`
animation: ${addOverlay} 0.3s forwards;
height: 100vh;
left: 0;
position: fixed;
top: 0;
width: 100vw;
z-index: ${zIndex.slideupOverlay};
`;
19 changes: 12 additions & 7 deletions src/components/SlideUp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {createPortal} from 'react-dom';
import clsx from 'clsx';
import {SFC} from 'types/generic';
import {bemify} from '@thenewboston/utils';

import './SlideUp.scss';
import * as S from './Style';

interface ComponentProps {
close(): void;
Expand All @@ -13,12 +12,18 @@ interface ComponentProps {
const SlideUp: SFC<ComponentProps> = ({children, className, close}) => {
return createPortal(
<>
<div className="SlideUp__overlay" onClick={close} role="button" tabIndex={0} data-testid="SlideUp__overlay" />
<div className={clsx('SlideUp', className)} data-testid="SlideUp">
<div className={clsx('SlideUp__content', {...bemify(className, '__content')})} data-testid="SlideUp__content">
<S.SlideUpOverlay
className={`${className}"__overlay"`}
onClick={close}
role="button"
tabIndex={0}
data-testid="SlideUp__overlay"
/>
<S.SlideUp className={className} data-testid="SlideUp">
<S.SlideUpContent className={clsx({...bemify(className, '__content')})} data-testid="SlideUp__content">
{children}
</div>
</div>
</S.SlideUpContent>
</S.SlideUp>
</>,
document.getElementById('slide-up-root')!,
);
Expand Down
1 change: 1 addition & 0 deletions src/styles/colors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const colors = {
'900': '#1a2936',
},
gray: {
'005': '#ededed',
'050': '#f7fafc',
'075': '#eef2f6',
'100': '#e3e8ee',
Expand Down

0 comments on commit 722863c

Please sign in to comment.