Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feat/LW-6695-staking-…
…package-setup
- Loading branch information
Showing
35 changed files
with
164 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { GlobalProvider, ThemeState } from '@ladle/react'; | ||
import { ThemeColorScheme, ThemeProvider } from '@lace/ui'; | ||
import React, { useMemo } from 'react'; | ||
|
||
export const Provider: GlobalProvider = ({ children, globalState }) => { | ||
const isLightTheme = useMemo(() => globalState.theme === ThemeState.Light, [globalState.theme]); | ||
return ( | ||
<ThemeProvider colorScheme={isLightTheme ? ThemeColorScheme.Light : ThemeColorScheme.Dark}> | ||
{children} | ||
</ThemeProvider> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
current | ||
difference |
Binary file not shown.
Binary file added
BIN
+10.3 KB
...king/.lostpixel/baseline/overview--staking-overview-navigation--basic-story.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
# Staking package structure | ||
|
||
## Problem | ||
|
||
Staking package should have a well described way of splitting the code, based on our past experiences. | ||
The way for the separation of concerns should be easy to understand by any developer reading this codebase. | ||
|
||
## Solution | ||
|
||
There are numerous ways to split the codebase including: | ||
|
||
1. Atomic Design (atoms, molecules, organisms, templates, and views) | ||
2. NextJS-like simple split (components, views) | ||
3. BEM-like splitting (elements, blocks) | ||
4. Flat components directories | ||
5. Feature-based design | ||
|
||
We have chosen to go with Feature-based design. | ||
We also discussed combining Feature-based design with Atomic Design, but it seemed to be an overkill. | ||
|
||
### Proposed structure | ||
|
||
- src | ||
- features | ||
- overview | ||
- OverviewNavigation | ||
- StakingCard | ||
- StakingOverviewView | ||
- index | ||
- StakingView | ||
- StakingView | ||
- index |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/staking/src/features/overview/OverviewNavigation.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,19 @@ | ||
import type { Story, StoryDefault } from '@ladle/react'; | ||
import { OverviewNavigation } from './OverviewNavigation'; | ||
|
||
export const BasicStory: Story<{ onValueChange: (newValue: string) => void }> = ({ onValueChange }) => ( | ||
<OverviewNavigation onValueChange={onValueChange} /> | ||
); | ||
|
||
BasicStory.argTypes = { | ||
onValueChange: { | ||
action: 'valueChanged', | ||
}, | ||
}; | ||
|
||
const storyDefault: StoryDefault = { | ||
title: 'Overview / Staking Overview Navigation', | ||
}; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default storyDefault; |
14 changes: 14 additions & 0 deletions
14
packages/staking/src/features/overview/OverviewNavigation.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,14 @@ | ||
import { SubNavigation } from '@lace/ui'; | ||
|
||
type OverviewNavigationProps = Omit<SubNavigation.SubNavigationRootProps, 'children'>; | ||
|
||
export const OverviewNavigation = ({ onValueChange, defaultValue = 'overview' }: OverviewNavigationProps) => ( | ||
<SubNavigation.Root | ||
aria-label="Staking Overview Navigation" | ||
defaultValue={defaultValue} | ||
onValueChange={onValueChange} | ||
> | ||
<SubNavigation.Item name="Overview" value="overview" /> | ||
<SubNavigation.Item name="Browse pools" value="browse" /> | ||
</SubNavigation.Root> | ||
); |
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 @@ | ||
export { OverviewNavigation } from './OverviewNavigation'; |
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,8 @@ | ||
import type { Story } from '@ladle/react'; | ||
import { Staking } from './Staking'; | ||
|
||
export const StakingStory: Story = () => <Staking />; | ||
|
||
StakingStory.args = { | ||
test: true, | ||
}; |
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,10 @@ | ||
import { render } from '@testing-library/react'; | ||
import { Staking } from './Staking'; | ||
|
||
describe('test prop', () => { | ||
it('renders properly', () => { | ||
const { container } = render(<Staking />); | ||
|
||
expect(container.textContent).toMatchInlineSnapshot('"StakingOverviewBrowse pools"'); | ||
}); | ||
}); |
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,9 @@ | ||
import { Text } from '@lace/ui'; | ||
import { OverviewNavigation } from '../overview'; | ||
|
||
export const Staking = () => ( | ||
<> | ||
<Text.Heading>Staking</Text.Heading> | ||
<OverviewNavigation /> | ||
</> | ||
); |
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 @@ | ||
export { Staking } from './Staking'; |
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,2 +1 @@ | ||
export { Example } from './Example'; | ||
export type { ExampleProps } from './Example'; | ||
export { Staking } from './features/staking'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { SubNavigation as Root } from './sub-navigation.component'; | ||
export { Item } from './sub-navigation-item.component'; | ||
export type { SubNavigationRootProps } from './sub-navigation.component'; |
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 +1,2 @@ | ||
export * from './design-system'; | ||
export { ThemeColorScheme, ThemeProvider } from './design-tokens'; |
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.