Skip to content

Commit

Permalink
Merge pull request #853 from alexstotsky/improve-tabs
Browse files Browse the repository at this point in the history
(improvements) Navigation tabs
  • Loading branch information
ezewer authored Sep 9, 2024
2 parents 6434b7a + 89a39ff commit abfac70
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 65 deletions.
5 changes: 2 additions & 3 deletions src/components/AppSummary/_AppSummary.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.app-summary {
&-card {
padding-left: 32px;
padding-right: 32px;
padding-top: 18px;
padding-bottom: 0;
}

Expand All @@ -11,7 +10,7 @@

&-title {
max-height: 35px;
margin-bottom: 5px;
margin-bottom: 18px;
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/Candles/Candles.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ class Candles extends PureComponent {
return (
<Card
elevation={Elevation.ZERO}
className='col-lg-12 col-md-12 col-sm-12 col-xs-12'
className='candles col-lg-12 col-md-12 col-sm-12 col-xs-12'
>
<SectionHeader>
<SectionHeaderTitle>
{t('candles.title')}
</SectionHeaderTitle>
<SectionSwitch target={TYPE} />
<SectionHeaderRow>
<SectionHeaderItem>
<SectionHeaderItemLabel>
Expand Down Expand Up @@ -165,12 +166,9 @@ class Candles extends PureComponent {
/>
<RefreshButton onClick={refresh} />
<CandlesSyncPref />
<GoToButton onClick={toggleGoToRangeDialog} />
</SectionHeaderRow>
</SectionHeader>
<div className='candles-header'>
<SectionSwitch target={TYPE} hasSubSections />
<GoToButton onClick={toggleGoToRangeDialog} />
</div>
{showContent}
</Card>
)
Expand Down
9 changes: 2 additions & 7 deletions src/components/Candles/_Candles.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
.candles-header {
display: flex;

.section-switch {
margin-right: 20px;
}

.candles {
.go-to-button {
margin-top: 3px;
cursor: pointer;
transform: scale(0.9);
}
}
2 changes: 0 additions & 2 deletions src/components/Positions/Positions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import {
checkInit,
Expand Down Expand Up @@ -161,7 +160,6 @@ class Positions extends PureComponent {
refresh={refresh}
clearTargetPairs={this.clearPairs}
/>
<SectionSwitch target={TYPE} hasSubSections />
{showContent}
</Card>
)
Expand Down
8 changes: 2 additions & 6 deletions src/components/PositionsActive/PositionsActive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import { checkFetch } from 'state/utils'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import getColumns from 'components/Positions/Positions.columns'

Expand Down Expand Up @@ -110,13 +109,10 @@ class PositionsActive extends PureComponent {
<SectionHeader
filter={false}
target={TYPE}
showHeaderTabs
timeframe={false}
title='activepositions.title'
/>
<SectionSwitch
target={TYPE}
hasSubSections
refresh={refresh}
title='activepositions.title'
/>
{showContent}
</Card>
Expand Down
8 changes: 2 additions & 6 deletions src/components/PositionsAudit/PositionsAudit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import { checkInit, checkFetch } from 'state/utils'
import getColumns from 'components/Positions/Positions.columns'
Expand Down Expand Up @@ -113,12 +112,9 @@ class PositionsAudit extends PureComponent {
<SectionHeader
filter={false}
target={TYPE}
title='paudit.title'
/>
<SectionSwitch
target={TYPE}
hasSubSections
showHeaderTabs
refresh={refresh}
title='paudit.title'
/>
{showContent}
</Card>
Expand Down
21 changes: 10 additions & 11 deletions src/components/Snapshots/Snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,18 @@ class Snapshots extends PureComponent {
}

return (
<Card elevation={Elevation.ZERO} className='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
<Card elevation={Elevation.ZERO} className='snapshots col-lg-12 col-md-12 col-sm-12 col-xs-12'>
<SectionHeader>
<SectionHeaderTitle>{t('snapshots.title')}</SectionHeaderTitle>
<NavSwitcher
items={[
{ value: MENU_POSITIONS, label: t('positions.title') },
{ value: MENU_TICKERS, label: t('tickers.title') },
{ value: MENU_WALLETS, label: t('wallets.title') },
]}
onChange={this.switchSection}
value={section}
/>
<SectionHeaderRow>
<SectionHeaderItem>
<SectionHeaderItemLabel>
Expand All @@ -175,16 +184,6 @@ class Snapshots extends PureComponent {
<RefreshButton onClick={refresh} />
</SectionHeaderRow>
</SectionHeader>

<NavSwitcher
items={[
{ value: MENU_POSITIONS, label: t('positions.title') },
{ value: MENU_TICKERS, label: t('tickers.title') },
{ value: MENU_WALLETS, label: t('wallets.title') },
]}
onChange={this.switchSection}
value={section}
/>
{showContent}
</Card>
)
Expand Down
22 changes: 15 additions & 7 deletions src/components/Snapshots/_Snapshots.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
.snapshots {
.section-header {
&-title {
margin-bottom: 29px;
}
}

.tickers {
.tables-row {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;

&-item {
width: 49%;
margin-right: 0;
min-width: 300px;
width: 49%;
margin-right: 0;
min-width: 300px;
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Trades/Trades.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { isEmpty } from '@bitfinex/lib-js-util-base'
import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import {
checkInit,
Expand Down Expand Up @@ -102,7 +101,6 @@ class Trades extends PureComponent {
refresh={refresh}
clearTargetPairs={this.clearPairs}
/>
<SectionSwitch target={TYPE} hasSubSections />
{showContent}
</Card>
)
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ a {

.section-switch {
margin-left: 1px;
margin-bottom: 30px;
margin-bottom: 20px;

.bp3-button-group {
display: block;
Expand Down
25 changes: 13 additions & 12 deletions src/ui/NavSwitcher/_NavSwitcher.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
.nav-switcher {
width: 100%;
border-bottom: 1px solid var(--borderColor);
padding-bottom: 5px;
margin-bottom: 40px;
margin-bottom: 20px;
padding-bottom: 6px;
border-bottom: 2px solid var(--borderColor);

&-item {
width: fit-content;
margin-bottom: 10px;
padding: 0 3px 6px 3px;
border: none;
padding: 7px 0;
border-radius: 0;
margin-right: 20px;
color: var(--color2);
min-width: fit-content;
background-color: var(--bgColor2);
border-bottom: 2px solid var(--borderColor);
cursor: pointer;

&:not(:last-child) {
margin-right: 24px;
}

&--active {
color: var(--activeColor);
border-bottom: 4px solid var(--activeColor);
color: var(--color);
border-bottom: 2px solid var(--color);
}
}
}
6 changes: 3 additions & 3 deletions src/ui/SectionSwitch/SectionSwitch.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export const POSITIONS_SECTIONS = [
},
]

export const getSections = (target, hasSubSections) => {
if (_includes(TRADES_TARGETS, target) && hasSubSections) return TRADES_SECTIONS
if (_includes(POSITIONS_TARGETS, target) && hasSubSections) return POSITIONS_SECTIONS
export const getSections = (target) => {
if (_includes(TRADES_TARGETS, target)) return TRADES_SECTIONS
if (_includes(POSITIONS_TARGETS, target)) return POSITIONS_SECTIONS
if (_includes(ANALYSIS_STAT_TARGETS, target)) return ANALYSIS_STAT_SECTIONS
if (_includes(FUNDING_TARGETS, target)) return FUNDING_SECTIONS
if (_includes(EARNINGS_TARGETS, target)) return EARNINGS_SECTIONS
Expand Down
29 changes: 29 additions & 0 deletions src/ui/SectionSwitch/_SectionSwitch.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.section-switch {
width: 100%;
margin-bottom: 20px;
border-bottom: 2px solid var(--borderColor);

.bp3-button-group {
margin-bottom: -2px;

.bp3-button {
border: none;
padding: 17px 0;
border-radius: 0;
color: var(--color2);
min-width: fit-content;
margin-right: 20px !important;
background-color: var(--bgColor2);
border-bottom: 2px solid var(--borderColor);

&:hover {
color: var(--color);
}

&.bp3-intent-primary {
color: var(--color);
border-bottom: 2px solid var(--color);
}
}
}
}
1 change: 1 addition & 0 deletions src/ui/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@import "./RefreshButton/_RefreshButton.scss";
@import "./ClearFiltersButton/_ClearFiltersButton.scss";
@import "./SectionHeader/_SectionHeader.scss";
@import "./SectionSwitch/_SectionSwitch.scss";
@import "./Select/_Select.scss";
@import "./SyncButton/_SyncButton.scss";
@import "./SyncPrefButton/_SyncPrefButton.scss";
Expand Down

0 comments on commit abfac70

Please sign in to comment.