From 01b9aec0341a67cde523aca203cd9d59c11eeb93 Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 25 Jan 2018 14:32:34 +0100 Subject: [PATCH] Disabled state for tabs items --- src/components/SettingsPage/index.js | 5 +++++ src/components/base/Tabs/index.js | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/SettingsPage/index.js b/src/components/SettingsPage/index.js index 23863f9a..341f7a13 100644 --- a/src/components/SettingsPage/index.js +++ b/src/components/SettingsPage/index.js @@ -67,26 +67,31 @@ class SettingsPage extends PureComponent { }, { key: 'money', + isDisabled: true, title: t('settings.tabs.money'), render: () =>
{'Monnaie'}
, }, { key: 'material', + isDisabled: true, title: t('settings.tabs.material'), render: () =>
{'Matériel'}
, }, { key: 'app', + isDisabled: true, title: t('settings.tabs.app'), render: () =>
{'App (beta)'}
, }, { key: 'tools', + isDisabled: true, title: t('settings.tabs.tools'), render: () =>
{'Outils'}
, }, { key: 'blockchain', + isDisabled: true, title: t('settings.tabs.blockchain'), render: () =>
{'Blockchain'}
, }, diff --git a/src/components/base/Tabs/index.js b/src/components/base/Tabs/index.js index 3d01824b..2d257506 100644 --- a/src/components/base/Tabs/index.js +++ b/src/components/base/Tabs/index.js @@ -16,15 +16,17 @@ const Tab = styled(Tabbable).attrs({ })` border-bottom: 2px solid transparent; border-bottom-color: ${p => (p.isActive ? p.theme.colors.blue : '')}; - color: ${p => (p.isActive ? p.theme.colors.blue : p.theme.colors.steel)}; + color: ${p => + p.isActive ? p.theme.colors.blue : p.isDisabled ? p.theme.colors.grey : p.theme.colors.steel}; margin-bottom: -1px; outline: none; - cursor: ${p => (p.isActive ? 'default' : 'pointer')}; + cursor: ${p => (p.isActive ? 'default' : p.isDisabled ? 'not-allowed' : 'pointer')}; max-width: 200px; ` type Item = { key: string | number, + isDisabled?: boolean, title: string | Element, render: () => Element, } @@ -39,7 +41,12 @@ const Tabs = ({ items, index, onTabClick }: Props) => ( {items.map((item, i) => ( - onTabClick(i)}> + onTabClick(i)} + > {item.title} ))}