-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release Adena version '1.7.3' (#227)
- Loading branch information
Showing
62 changed files
with
1,343 additions
and
194 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
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
32 changes: 32 additions & 0 deletions
32
...rc/components/add-custom-network/add-custom-network-form/add-custom-network-form.spec.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,32 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import { ThemeProvider } from 'styled-components'; | ||
import { render } from '@testing-library/react'; | ||
import theme from '@styles/theme'; | ||
import { GlobalStyle } from '@styles/global-style'; | ||
import AddCustomNetworkForm, { AddCustomNetworkFormProps } from './add-custom-network-form'; | ||
|
||
describe('AddCustomNetworkForm Component', () => { | ||
it('AddCustomNetworkForm render', () => { | ||
const args: AddCustomNetworkFormProps = { | ||
name: '', | ||
rpcUrl: '', | ||
hasRPCUrlError: false, | ||
chainId: '', | ||
onChangeName: () => { return; }, | ||
onChangeRPCUrl: () => { return; }, | ||
onChangeChainId: () => { return; }, | ||
save: () => { return; }, | ||
cancel: () => { return; }, | ||
}; | ||
|
||
render( | ||
<RecoilRoot> | ||
<GlobalStyle /> | ||
<ThemeProvider theme={theme}> | ||
<AddCustomNetworkForm {...args} /> | ||
</ThemeProvider> | ||
</RecoilRoot>, | ||
); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
...components/add-custom-network/add-custom-network-form/add-custom-network-form.stories.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,22 @@ | ||
import AddCustomNetworkForm, { type AddCustomNetworkFormProps } from './add-custom-network-form'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
export default { | ||
title: 'components/add-custom-network/AddCustomNetworkForm', | ||
component: AddCustomNetworkForm, | ||
} as Meta<typeof AddCustomNetworkForm>; | ||
|
||
export const Default: StoryObj<AddCustomNetworkFormProps> = { | ||
args: { | ||
name: '', | ||
rpcUrl: '', | ||
hasRPCUrlError: false, | ||
chainId: '', | ||
onChangeName: action('onChangeName'), | ||
onChangeRPCUrl: action('onChangeRPCUrl'), | ||
onChangeChainId: action('onChangeChainId'), | ||
save: action('save'), | ||
cancel: action('cancel'), | ||
}, | ||
}; |
91 changes: 91 additions & 0 deletions
91
...c/components/add-custom-network/add-custom-network-form/add-custom-network-form.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,91 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const AddCustomNetworkFormWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
height: 100%; | ||
.input-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
.input-box { | ||
display: flex; | ||
flex-direction: row; | ||
width: 100%; | ||
min-height: 48px; | ||
padding: 12px 16px; | ||
${({ theme }) => theme.fonts.body2Reg}; | ||
background-color: ${({ theme }) => theme.color.neutral[8]}; | ||
border: 1px solid ${({ theme }) => theme.color.neutral[6]}; | ||
border-radius: 30px; | ||
align-items: center; | ||
margin-top: 12px; | ||
:first-child { | ||
margin-top: 0; | ||
} | ||
input { | ||
display: flex; | ||
width: 100%; | ||
height: auto; | ||
resize: none; | ||
overflow: hidden; | ||
line-height: 25px; | ||
::placeholder { | ||
color: ${({ theme }) => theme.color.neutral[9]}; | ||
} | ||
} | ||
} | ||
} | ||
.error-message { | ||
position: relative; | ||
padding: 0 16px; | ||
${({ theme }) => theme.fonts.captionReg}; | ||
color: ${({ theme }) => theme.color.red[2]}; | ||
} | ||
.submit-wrapper { | ||
position: absolute; | ||
display: flex; | ||
width: 100%; | ||
bottom: 0; | ||
justify-content: space-between; | ||
button { | ||
width: 100%; | ||
height: 48px; | ||
border-radius: 30px; | ||
${({ theme }) => theme.fonts.body1Bold}; | ||
background-color: ${({ theme }) => theme.color.neutral[4]}; | ||
transition: 0.2s; | ||
:hover { | ||
background-color: ${({ theme }) => theme.color.neutral[5]}; | ||
} | ||
&:last-child { | ||
margin-left: 10px; | ||
} | ||
&.save { | ||
background-color: ${({ theme }) => theme.color.primary[3]}; | ||
:hover { | ||
background-color: ${({ theme }) => theme.color.primary[4]}; | ||
} | ||
&.disabled { | ||
color: ${({ theme }) => theme.color.neutral[4]}; | ||
background-color: ${({ theme }) => theme.color.primary[6]}; | ||
cursor: default; | ||
} | ||
} | ||
} | ||
} | ||
`; |
94 changes: 94 additions & 0 deletions
94
...ion/src/components/add-custom-network/add-custom-network-form/add-custom-network-form.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,94 @@ | ||
import React, { useCallback } from 'react'; | ||
import { AddCustomNetworkFormWrapper } from './add-custom-network-form.styles'; | ||
|
||
export interface AddCustomNetworkFormProps { | ||
name: string; | ||
rpcUrl: string | ||
hasRPCUrlError: boolean; | ||
chainId: string; | ||
onChangeName: (name: string) => void; | ||
onChangeRPCUrl: (rpcUrl: string) => void; | ||
onChangeChainId: (chainId: string) => void; | ||
save: () => void; | ||
cancel: () => void; | ||
} | ||
|
||
const AddCustomNetworkForm: React.FC<AddCustomNetworkFormProps> = ({ | ||
name, | ||
onChangeName, | ||
rpcUrl, | ||
onChangeRPCUrl, | ||
hasRPCUrlError, | ||
chainId, | ||
onChangeChainId, | ||
save, | ||
cancel, | ||
}) => { | ||
|
||
const isSavable = useCallback(() => { | ||
return name.length > 0 && | ||
rpcUrl.length > 0 && | ||
chainId.length > 0; | ||
}, [name, rpcUrl, chainId]); | ||
|
||
const onClickSave = useCallback(() => { | ||
save(); | ||
}, [save]); | ||
|
||
const onClickCancel = useCallback(() => { | ||
cancel(); | ||
}, [cancel]); | ||
|
||
return ( | ||
<AddCustomNetworkFormWrapper> | ||
<div className='input-wrapper'> | ||
<div className='input-box'> | ||
<input | ||
type='text' | ||
value={name} | ||
autoComplete='off' | ||
onChange={event => onChangeName(event.target.value)} | ||
placeholder='Network Name' | ||
/> | ||
</div> | ||
<div className='input-box'> | ||
<input | ||
type='text' | ||
value={rpcUrl} | ||
autoComplete='off' | ||
onChange={event => onChangeRPCUrl(event.target.value)} | ||
placeholder='RPC URL' | ||
/> | ||
</div> | ||
{ | ||
hasRPCUrlError && | ||
<span className='error-message'>{'Invalid URL'}</span> | ||
} | ||
<div className='input-box'> | ||
<input | ||
type='text' | ||
value={chainId} | ||
autoComplete='off' | ||
onChange={event => onChangeChainId(event.target.value)} | ||
placeholder='Chain ID' | ||
/> | ||
</div> | ||
</div> | ||
<div className='submit-wrapper'> | ||
<button | ||
className='cancel' | ||
onClick={onClickCancel}> | ||
{'Cancel'} | ||
</button> | ||
<button | ||
className={isSavable() ? 'save' : 'save disabled'} | ||
onClick={onClickSave} | ||
> | ||
{'Save'} | ||
</button> | ||
</div> | ||
</AddCustomNetworkFormWrapper> | ||
); | ||
}; | ||
|
||
export default AddCustomNetworkForm; |
Oops, something went wrong.