forked from tari-project/tari
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from Altalogy/launchpad/feature/7/base_node
feat: base node tab
- Loading branch information
Showing
30 changed files
with
413 additions
and
126 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
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,13 +1,80 @@ | ||
import styled from 'styled-components' | ||
|
||
export const StyledButton = styled.button` | ||
border-radius: 8px; | ||
import { ButtonProps } from './types' | ||
|
||
export const StyledButton = styled.button< | ||
Pick<ButtonProps, 'variant' | 'type'> | ||
>` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: baseline; | ||
border-radius: ${({ theme }) => theme.tightBorderRadius()}; | ||
border: ${({ theme, variant, type }) => { | ||
if (variant === 'text') { | ||
return 'none' | ||
} | ||
if (type === 'reset') { | ||
return '1px solid transparent' | ||
} | ||
return `1px solid ${theme.accent}` | ||
}}; | ||
box-shadow: none; | ||
border-width: 0; | ||
padding: ${({ theme }) => theme.spacingVertical()} | ||
${({ theme }) => theme.spacingHorizontal()}; | ||
cursor: pointer; | ||
background: ${({ variant, type, theme }) => { | ||
if (type === 'reset') { | ||
return theme.resetBackground | ||
} | ||
return variant === 'text' ? 'transparent' : theme.tariGradient | ||
}}; | ||
color: ${({ variant, theme }) => | ||
variant === 'text' ? theme.secondary : theme.primary}; | ||
outline: none; | ||
& * { | ||
color: inherit; | ||
} | ||
&:hover { | ||
background: ${({ variant, theme, type }) => { | ||
if (variant === 'text') { | ||
return 'auto' | ||
} | ||
if (type === 'reset') { | ||
return theme.resetBackgroundDark | ||
} | ||
return theme.accent | ||
}}; | ||
} | ||
` | ||
|
||
export const StyledLink = styled.a`` | ||
export const StyledLink = styled.a<Pick<ButtonProps, 'variant'>>` | ||
background: ${({ variant, theme }) => | ||
variant === 'text' ? 'transparent' : theme.tariGradient}; | ||
color: ${({ variant, theme }) => | ||
variant === 'text' ? theme.secondary : theme.primary}; | ||
` | ||
|
||
export const ButtonText = styled.span`` | ||
|
||
export const IconWrapper = styled.span`` | ||
export const IconWrapper = styled.span` | ||
color: inherit; | ||
width: 0; | ||
height: 1em; | ||
position: relative; | ||
& > * { | ||
position: absolute; | ||
top: 0; | ||
left: 100%; | ||
width: ${({ theme }) => theme.spacing(0.66)}; | ||
height: ${({ theme }) => theme.spacing(0.66)}; | ||
transform: translateY(-50%); | ||
color: inherit; | ||
} | ||
` |
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
20 changes: 20 additions & 0 deletions
20
applications/launchpad_v2/src/components/Loading/index.tsx
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import LoadingIcon from '../../styles/Icons/Loading' | ||
|
||
import { StyledSpan } from './styles' | ||
|
||
/** | ||
* Loading | ||
* renders a spinning loading indicator | ||
* | ||
* @prop {boolean} loading - controls whether the indicator should be shown or not | ||
* @prop {string} [testId] - optional testId to assign for testing purposes | ||
*/ | ||
|
||
const Loading = ({ loading, testId }: { loading?: boolean; testId?: string }) => | ||
loading ? ( | ||
<StyledSpan data-testid={testId || 'loading-indicator'}> | ||
<LoadingIcon /> | ||
</StyledSpan> | ||
) : null | ||
|
||
export default Loading |
14 changes: 14 additions & 0 deletions
14
applications/launchpad_v2/src/components/Loading/styles.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled, { keyframes } from 'styled-components' | ||
|
||
const spinKeyframes = keyframes` | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
` | ||
|
||
export const StyledSpan = styled.span` | ||
animation: ${spinKeyframes} infinite 2s linear; | ||
` |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import { ThemeProvider } from 'styled-components' | ||
|
||
import themes from '../../styles/themes' | ||
import Loading from '.' | ||
|
||
describe('Loading', () => { | ||
it('should render loading indicator when loading=true', () => { | ||
const testId = 'loading=true' | ||
render( | ||
<ThemeProvider theme={themes.light}> | ||
<Loading loading={true} testId={testId} /> | ||
</ThemeProvider>, | ||
) | ||
|
||
const el = screen.getByTestId(testId) | ||
expect(el).toBeInTheDocument() | ||
}) | ||
|
||
it('should NOT render loading indicator when loading=false', () => { | ||
const testId = 'loading=false' | ||
render( | ||
<ThemeProvider theme={themes.light}> | ||
<Loading loading={false} testId={testId} /> | ||
</ThemeProvider>, | ||
) | ||
|
||
const el = screen.queryByTestId(testId) | ||
expect(el).not.toBeInTheDocument() | ||
}) | ||
}) |
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
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,16 +1,18 @@ | ||
import { ReactNode } from 'react' | ||
|
||
export type SelectInternalProps = { | ||
disabled?: boolean | ||
inverted?: boolean | ||
children?: ReactNode | ||
open?: boolean | ||
} | ||
|
||
type Option = { value: string; label: string; key: string } | ||
export type SelectProps = { | ||
disabled?: boolean | ||
inverted?: boolean | ||
label: string | ||
value: Option | ||
value?: Option | ||
options: Option[] | ||
onChange: (option: Option) => void | ||
} |
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
Oops, something went wrong.