feat: styled preferences page cards.

This commit is contained in:
a.bouhuolia
2021-12-25 19:35:07 +02:00
parent 5defb5a279
commit 6975ebb9e7
6 changed files with 65 additions and 22 deletions

View File

@@ -1,5 +1,8 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styled from 'styled-components';
import { Card } from 'components';
import { CLASSES } from 'common/classes'; import { CLASSES } from 'common/classes';
import { useAccounts, useSaveSettings, useSettings } from 'hooks/query'; import { useAccounts, useSaveSettings, useSettings } from 'hooks/query';
import PreferencesPageLoader from '../PreferencesPageLoader'; import PreferencesPageLoader from '../PreferencesPageLoader';
@@ -35,16 +38,21 @@ function AccountantFormProvider({ ...props }) {
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
)} )}
> >
<div className={classNames(CLASSES.CARD)}> <AccountantFormCard>
{isLoading ? ( {isLoading ? (
<PreferencesPageLoader /> <PreferencesPageLoader />
) : ( ) : (
<AccountantFormContext.Provider value={provider} {...props} /> <AccountantFormContext.Provider value={provider} {...props} />
)} )}
</div> </AccountantFormCard>
</div> </div>
); );
} }
const useAccountantFormContext = () => React.useContext(AccountantFormContext); const useAccountantFormContext = () => React.useContext(AccountantFormContext);
export { AccountantFormProvider, useAccountantFormContext }; export { AccountantFormProvider, useAccountantFormContext };
const AccountantFormCard = styled(Card)`
padding: 25px;
`;

View File

@@ -1,20 +1,26 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styled from 'styled-components';
import { Card } from 'components';
import { CLASSES } from 'common/classes'; import { CLASSES } from 'common/classes';
import CurrenciesList from './CurrenciesList'; import CurrenciesList from './CurrenciesList';
export default function PreferencesCurrenciesPage() { export default function PreferencesCurrenciesPage() {
return ( return (
<div className={classNames( <div
className={classNames(
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_CURRENCIES, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_CURRENCIES,
)}> )}
<div className={classNames(CLASSES.CARD)}> >
<CurrenciesCard>
<CurrenciesList /> <CurrenciesList />
</CurrenciesCard>
</div> </div>
</div> );
)
} }
const CurrenciesCard = styled(Card)`
padding: 0;
`;

View File

@@ -1,5 +1,8 @@
import React, { createContext } from 'react'; import React, { createContext } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styled from 'styled-components';
import { Card } from 'components';
import { CLASSES } from 'common/classes'; import { CLASSES } from 'common/classes';
import { import {
useCurrentOrganization, useCurrentOrganization,
@@ -45,13 +48,13 @@ function GeneralFormProvider({ ...props }) {
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_GENERAL, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_GENERAL,
)} )}
> >
<div className={classNames(CLASSES.CARD)}> <GeneralFormCard>
{isOrganizationLoading || isDateFormatsLoading ? ( {isOrganizationLoading || isDateFormatsLoading ? (
<PreferencesPageLoader /> <PreferencesPageLoader />
) : ( ) : (
<GeneralFormContext.Provider value={provider} {...props} /> <GeneralFormContext.Provider value={provider} {...props} />
)} )}
</div> </GeneralFormCard>
</div> </div>
); );
} }
@@ -59,3 +62,7 @@ function GeneralFormProvider({ ...props }) {
const useGeneralFormContext = () => React.useContext(GeneralFormContext); const useGeneralFormContext = () => React.useContext(GeneralFormContext);
export { GeneralFormProvider, useGeneralFormContext }; export { GeneralFormProvider, useGeneralFormContext };
const GeneralFormCard = styled(Card)`
padding: 25px;
`;

View File

@@ -1,7 +1,9 @@
import React, { useContext, createContext } from 'react'; import React, { useContext, createContext } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { CLASSES } from 'common/classes'; import styled from 'styled-components';
import { CLASSES } from 'common/classes';
import { Card } from 'components';
import { useSettingsItems, useAccounts, useSaveSettings } from 'hooks/query'; import { useSettingsItems, useAccounts, useSaveSettings } from 'hooks/query';
import PreferencesPageLoader from '../PreferencesPageLoader'; import PreferencesPageLoader from '../PreferencesPageLoader';
@@ -38,13 +40,13 @@ function ItemPreferencesFormProvider({ ...props }) {
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
)} )}
> >
<div className={classNames(CLASSES.CARD)}> <ItemsPreferencesCard>
{isLoading ? ( {isLoading ? (
<PreferencesPageLoader /> <PreferencesPageLoader />
) : ( ) : (
<ItemFormContext.Provider value={provider} {...props} /> <ItemFormContext.Provider value={provider} {...props} />
)} )}
</div> </ItemsPreferencesCard>
</div> </div>
); );
} }
@@ -52,3 +54,7 @@ function ItemPreferencesFormProvider({ ...props }) {
const useItemPreferencesFormContext = () => useContext(ItemFormContext); const useItemPreferencesFormContext = () => useContext(ItemFormContext);
export { useItemPreferencesFormContext, ItemPreferencesFormProvider }; export { useItemPreferencesFormContext, ItemPreferencesFormProvider };
const ItemsPreferencesCard = styled(Card)`
padding: 25px;
`;

View File

@@ -1,10 +1,12 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { Tabs, Tab } from '@blueprintjs/core'; import { Tabs, Tab } from '@blueprintjs/core';
import classNames from 'classnames'; import classNames from 'classnames';
import styled from 'styled-components';
import { CLASSES } from 'common/classes'; import { CLASSES } from 'common/classes';
import SMSMessagesDataTable from './SMSMessagesDataTable'; import SMSMessagesDataTable from './SMSMessagesDataTable';
import { Card } from 'components';
import '../../../style/pages/Preferences/SMSIntegration.scss'; import '../../../style/pages/Preferences/SMSIntegration.scss';
@@ -12,6 +14,10 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { compose } from 'utils'; import { compose } from 'utils';
/**
* SMS Integration Tabs.
* @returns {React.JSX}
*/
function SMSIntegrationTabs({ function SMSIntegrationTabs({
// #withDashboardActions // #withDashboardActions
changePreferencesPageTitle, changePreferencesPageTitle,
@@ -21,7 +27,7 @@ function SMSIntegrationTabs({
}, [changePreferencesPageTitle]); }, [changePreferencesPageTitle]);
return ( return (
<div className={classNames(CLASSES.CARD)}> <SMSIntegrationCard>
<div className={classNames(CLASSES.PREFERENCES_PAGE_TABS)}> <div className={classNames(CLASSES.PREFERENCES_PAGE_TABS)}>
<Tabs animate={true} defaultSelectedTabId={'sms_messages'}> <Tabs animate={true} defaultSelectedTabId={'sms_messages'}>
<Tab <Tab
@@ -35,8 +41,12 @@ function SMSIntegrationTabs({
/> />
</Tabs> </Tabs>
</div> </div>
</div> </SMSIntegrationCard>
); );
} }
export default compose(withDashboardActions)(SMSIntegrationTabs); export default compose(withDashboardActions)(SMSIntegrationTabs);
const SMSIntegrationCard = styled(Card)`
padding: 0;
`;

View File

@@ -2,9 +2,11 @@ import React from 'react';
import { Tabs, Tab } from '@blueprintjs/core'; import { Tabs, Tab } from '@blueprintjs/core';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import classNames from 'classnames'; import classNames from 'classnames';
import styled from 'styled-components';
import 'style/pages/Preferences/Users.scss'; import 'style/pages/Preferences/Users.scss';
import { Card } from 'components';
import { CLASSES } from 'common/classes'; import { CLASSES } from 'common/classes';
import PreferencesSubContent from 'components/Preferences/PreferencesSubContent'; import PreferencesSubContent from 'components/Preferences/PreferencesSubContent';
@@ -23,7 +25,7 @@ function UsersPreferences({ openDialog }) {
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_USERS, CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_USERS,
)} )}
> >
<div className={classNames(CLASSES.CARD)}> <UsersPereferencesCard>
<div className={classNames(CLASSES.PREFERENCES_PAGE_TABS)}> <div className={classNames(CLASSES.PREFERENCES_PAGE_TABS)}>
<Tabs animate={true} onChange={onChangeTabs}> <Tabs animate={true} onChange={onChangeTabs}>
<Tab <Tab
@@ -38,9 +40,13 @@ function UsersPreferences({ openDialog }) {
/> />
</Tabs> </Tabs>
</div> </div>
</div> </UsersPereferencesCard>
</div> </div>
); );
} }
export default withUserPreferences(UsersPreferences); export default withUserPreferences(UsersPreferences);
const UsersPereferencesCard = styled(Card)`
padding: 0;
`;