From 4fe417809013c6372bb5de8b55d7fdd82951b9d4 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 13 Dec 2021 12:12:48 +0200 Subject: [PATCH] feat: optimize transactions locking style. --- .../TransactionsLockingList.js | 31 ++-- .../TransactionsLocking/components.js | 173 +++++++++++++----- 2 files changed, 146 insertions(+), 58 deletions(-) diff --git a/src/containers/TransactionsLocking/TransactionsLockingList.js b/src/containers/TransactionsLocking/TransactionsLockingList.js index 0ade6af12..77c2c0375 100644 --- a/src/containers/TransactionsLocking/TransactionsLockingList.js +++ b/src/containers/TransactionsLocking/TransactionsLockingList.js @@ -10,16 +10,21 @@ import { compose } from 'utils'; const DataTest = [ { + isEnabled: true, name: 'sales', + module: 'sales', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do', }, { + isEnabled: false, name: 'purchases', + module: 'purchases', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do', }, { + isEnabled: false, name: 'financial', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do', @@ -30,10 +35,20 @@ function Paragraph({ className, children }) { return

{children}

; } +function TransactionsLockingList({ items }) { + return items.map(({ isEnabled, name, description }) => ( + + )); +} + /** * Transactions locking list. */ -function TransactionsLockingList({ +function TransactionsLockingListPage({ // #withDialogActions openDialog, }) { @@ -56,28 +71,22 @@ function TransactionsLockingList({ {''}Lock All Transactions At Once → - {DataTest.map(({ name, description }) => ( - - ))} + ); } -export default compose(withDialogActions)(TransactionsLockingList); +export default compose(withDialogActions)(TransactionsLockingListPage); const TransactionsLocking = styled.div` display: flex; flex-direction: column; padding: 32px; - max-width: 700px; + max-width: 800px; `; const TransactionsLockingParagraph = styled(Paragraph)` - margin-bottom: 30px; + margin-bottom: 25px; `; const TransLockingTitle = styled.h2` diff --git a/src/containers/TransactionsLocking/components.js b/src/containers/TransactionsLocking/components.js index bd6825f41..8687fa98f 100644 --- a/src/containers/TransactionsLocking/components.js +++ b/src/containers/TransactionsLocking/components.js @@ -1,57 +1,117 @@ import React from 'react'; import styled from 'styled-components'; -import { Switch, FormGroup, Position } from '@blueprintjs/core'; -import { Hint, Icon, FormattedMessage as T } from 'components'; +import { + Button, + Position, + MenuItem, + Menu, + Intent, + Divider, +} from '@blueprintjs/core'; +import { Hint, Icon, If, FormattedMessage as T } from 'components'; +import { Popover2 } from '@blueprintjs/popover2'; +import { safeInvoke } from 'utils'; -export const TransactionLockingContent = ({ name, description, onSwitch }) => ( - - - - - +export const TransactionLockingContent = ({ + name, + description, + module, + isEnabled, + onLock, + onEditLock, + onUnlockFull, + onUnlockPartial, +}) => { + const handleLockClick = (event) => { + safeInvoke(onLock, module, event); + }; + const handleEditBtn = (event) => { + safeInvoke(onEditLock, module, event); + }; + const handleUnlockPartial = (event) => { + safeInvoke(onUnlockPartial, module, event); + }; -
- - {' '} - - - {description} -
- - - -
-
-); + const handleUnlockFull = (event) => { + safeInvoke(onUnlockFull, module, event); + }; + return ( + + + + + + + + + {' '} + + + {description} + + + + + + + + + + + + + + + } + placement="bottom" + > + + + + + + + ); +}; const TransactionLockingWrapp = styled.div` display: flex; align-items: center; border-radius: 6px; border: 1px solid #d1dee2; - padding: 14px 18px; - margin-bottom: 25px; + padding: 16px 18px; + margin-bottom: 22px; background: #fff; - - div.block { - flex: 1 1 0; - margin-left: 20px; - width: 100%; - } + box-shadow: 0 4px 20px -5px rgb(0 8 36 / 5%); `; -const TransactionsLockingcontent = styled.div` +const TransLockingInner = styled.div` display: flex; align-items: center; flex: 1 1 0; @@ -65,15 +125,34 @@ const TransLockingItemTitle = styled.h1` `; const TransLockingItemDesc = styled.p` margin-bottom: 0; - opacity: 0.8; + opacity: 0.9; `; const TransLockingIcon = styled.div` border: 1px solid #d2dde2; - height: 50px; - width: 50px; + height: 45px; + width: 45px; text-align: center; - line-height: 50px; - border-radius: 5px; - color: #8190ac; + line-height: 45px; + border-radius: 8px; + color: #93a1ba; + + .bp3-icon { + position: relative; + top: 1px; + } +`; + +export const TransLockingActions = styled.div` + display: flex; + + .bp3-divider { + margin: 2px; + } +`; + +export const TransLockingContent = styled.div` + flex: 1 1 0; + margin-left: 20px; + width: 100%; `;