aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-07-28 19:24:47 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-07-28 15:46:43 +0000
commitd671afec794992d052f6f6b7ea73a571e67db7c1 (patch)
tree940f97875da81b34465e1981461ec7152c2b08a5 /packages
parent- updated classnames to 2.3.1 to use added type definitions (diff)
downloadferdium-app-d671afec794992d052f6f6b7ea73a571e67db7c1.tar.gz
ferdium-app-d671afec794992d052f6f6b7ea73a571e67db7c1.tar.zst
ferdium-app-d671afec794992d052f6f6b7ea73a571e67db7c1.zip
Minor refactoring to use the destructured code pattern while importing from other modules.
Diffstat (limited to 'packages')
-rw-r--r--packages/forms/src/button/index.tsx12
-rw-r--r--packages/forms/src/input/styles.ts4
-rw-r--r--packages/forms/src/textarea/styles.ts4
-rw-r--r--packages/forms/src/toggle/index.tsx6
-rw-r--r--packages/theme/src/index.ts4
5 files changed, 15 insertions, 15 deletions
diff --git a/packages/forms/src/button/index.tsx b/packages/forms/src/button/index.tsx
index 8eba17415..0d036293a 100644
--- a/packages/forms/src/button/index.tsx
+++ b/packages/forms/src/button/index.tsx
@@ -1,7 +1,7 @@
1import Icon from '@mdi/react'; 1import Icon from '@mdi/react';
2import { Theme } from '@meetfranz/theme'; 2import { Theme } from '@meetfranz/theme';
3import classnames from 'classnames'; 3import classnames from 'classnames';
4import * as CSS from 'csstype'; 4import { Property } from 'csstype';
5import React, { Component } from 'react'; 5import React, { Component } from 'react';
6import injectStyle, { withTheme } from 'react-jss'; 6import injectStyle, { withTheme } from 'react-jss';
7import Loader from 'react-loader'; 7import Loader from 'react-loader';
@@ -34,13 +34,13 @@ const styles = (theme: Theme) => ({
34 borderRadius: theme.borderRadiusSmall, 34 borderRadius: theme.borderRadiusSmall,
35 border: 'none', 35 border: 'none',
36 display: 'inline-flex', 36 display: 'inline-flex',
37 position: 'relative' as CSS.Property.Position, 37 position: 'relative' as Property.Position,
38 transition: 'background .5s, opacity 0.3s', 38 transition: 'background .5s, opacity 0.3s',
39 textAlign: 'center' as CSS.Property.TextAlign, 39 textAlign: 'center' as Property.TextAlign,
40 outline: 'none', 40 outline: 'none',
41 alignItems: 'center', 41 alignItems: 'center',
42 padding: 0, 42 padding: 0,
43 width: (props: IProps) => (props.stretch ? '100%' : 'auto') as CSS.Property.Width<string>, 43 width: (props: IProps) => (props.stretch ? '100%' : 'auto') as Property.Width<string>,
44 fontSize: theme.uiFontSize, 44 fontSize: theme.uiFontSize,
45 textDecoration: 'none', 45 textDecoration: 'none',
46 // height: theme.buttonHeight, 46 // height: theme.buttonHeight,
@@ -113,7 +113,7 @@ const styles = (theme: Theme) => ({
113 opacity: theme.inputDisabledOpacity, 113 opacity: theme.inputDisabledOpacity,
114 }, 114 },
115 loader: { 115 loader: {
116 position: 'relative' as CSS.Property.Position, 116 position: 'relative' as Property.Position,
117 width: 20, 117 width: 20,
118 height: 18, 118 height: 18,
119 zIndex: 9999, 119 zIndex: 9999,
@@ -125,7 +125,7 @@ const styles = (theme: Theme) => ({
125 transition: 'all 0.3s', 125 transition: 'all 0.3s',
126 marginLeft: (props: IProps): number => (!props.busy ? 10 : 20), 126 marginLeft: (props: IProps): number => (!props.busy ? 10 : 20),
127 marginRight: (props: IProps): number => (!props.busy ? -10 : -20), 127 marginRight: (props: IProps): number => (!props.busy ? -10 : -20),
128 position: (props: IProps): CSS.Property.Position => props.stretch ? 'absolute' : 'inherit', 128 position: (props: IProps): Property.Position => props.stretch ? 'absolute' : 'inherit',
129 }, 129 },
130 icon: { 130 icon: {
131 margin: [1, 10, 0, -5], 131 margin: [1, 10, 0, -5],
diff --git a/packages/forms/src/input/styles.ts b/packages/forms/src/input/styles.ts
index 99b0685a8..1fe6a03cd 100644
--- a/packages/forms/src/input/styles.ts
+++ b/packages/forms/src/input/styles.ts
@@ -1,5 +1,5 @@
1import { Theme } from '@meetfranz/theme'; 1import { Theme } from '@meetfranz/theme';
2import * as CSS from 'csstype'; 2import { Property } from 'csstype';
3 3
4const prefixStyles = (theme: Theme) => ({ 4const prefixStyles = (theme: Theme) => ({
5 background: theme.inputPrefixBackground, 5 background: theme.inputPrefixBackground,
@@ -85,7 +85,7 @@ export default (theme: Theme) => ({
85 background: theme.inputBackground, 85 background: theme.inputBackground,
86 border: theme.inputBorder, 86 border: theme.inputBorder,
87 borderRadius: theme.borderRadiusSmall, 87 borderRadius: theme.borderRadiusSmall,
88 boxSizing: 'border-box' as CSS.Property.BoxSizing, 88 boxSizing: 'border-box' as Property.BoxSizing,
89 display: 'flex', 89 display: 'flex',
90 height: theme.inputHeight, 90 height: theme.inputHeight,
91 order: 1, 91 order: 1,
diff --git a/packages/forms/src/textarea/styles.ts b/packages/forms/src/textarea/styles.ts
index f1fb09367..15cc6ca1b 100644
--- a/packages/forms/src/textarea/styles.ts
+++ b/packages/forms/src/textarea/styles.ts
@@ -1,5 +1,5 @@
1import { Theme } from '@meetfranz/theme'; 1import { Theme } from '@meetfranz/theme';
2import * as CSS from 'csstype'; 2import { Property } from 'csstype';
3 3
4export default (theme: Theme) => ({ 4export default (theme: Theme) => ({
5 label: { 5 label: {
@@ -42,7 +42,7 @@ export default (theme: Theme) => ({
42 background: theme.inputBackground, 42 background: theme.inputBackground,
43 border: theme.inputBorder, 43 border: theme.inputBorder,
44 borderRadius: theme.borderRadiusSmall, 44 borderRadius: theme.borderRadiusSmall,
45 boxSizing: 'border-box' as CSS.Property.BoxSizing, 45 boxSizing: 'border-box' as Property.BoxSizing,
46 display: 'flex', 46 display: 'flex',
47 order: 1, 47 order: 1,
48 width: '100%', 48 width: '100%',
diff --git a/packages/forms/src/toggle/index.tsx b/packages/forms/src/toggle/index.tsx
index 50716450b..d484cd042 100644
--- a/packages/forms/src/toggle/index.tsx
+++ b/packages/forms/src/toggle/index.tsx
@@ -1,6 +1,6 @@
1import { Theme } from '@meetfranz/theme'; 1import { Theme } from '@meetfranz/theme';
2import classnames from 'classnames'; 2import classnames from 'classnames';
3import * as CSS from 'csstype'; 3import { Property } from 'csstype';
4import React, { Component } from 'react'; 4import React, { Component } from 'react';
5import injectStyle from 'react-jss'; 5import injectStyle from 'react-jss';
6 6
@@ -22,7 +22,7 @@ const styles = (theme: Theme) => ({
22 background: theme.toggleBackground, 22 background: theme.toggleBackground,
23 borderRadius: theme.borderRadius, 23 borderRadius: theme.borderRadius,
24 height: theme.toggleHeight, 24 height: theme.toggleHeight,
25 position: 'relative' as CSS.Property.Position, 25 position: 'relative' as Property.Position,
26 width: theme.toggleWidth, 26 width: theme.toggleWidth,
27 }, 27 },
28 button: { 28 button: {
@@ -33,7 +33,7 @@ const styles = (theme: Theme) => ({
33 height: theme.toggleHeight - 2, 33 height: theme.toggleHeight - 2,
34 left: 1, 34 left: 1,
35 top: 1, 35 top: 1,
36 position: 'absolute' as CSS.Property.Position, 36 position: 'absolute' as Property.Position,
37 transition: 'all .5s', 37 transition: 'all .5s',
38 }, 38 },
39 buttonActive: { 39 buttonActive: {
diff --git a/packages/theme/src/index.ts b/packages/theme/src/index.ts
index 78d1dcbb9..94df5afd1 100644
--- a/packages/theme/src/index.ts
+++ b/packages/theme/src/index.ts
@@ -1,13 +1,13 @@
1import makeDarkThemeConfig from './themes/dark'; 1import makeDarkThemeConfig from './themes/dark';
2import makeDefaultThemeConfig from './themes/default'; 2import makeDefaultThemeConfig from './themes/default';
3import * as legacyStyles from './themes/legacy'; 3import { themeBrandPrimary } from './themes/legacy';
4 4
5export enum ThemeType { 5export enum ThemeType {
6 default = 'default', 6 default = 'default',
7 dark = 'dark', 7 dark = 'dark',
8} 8}
9 9
10export const DEFAULT_ACCENT_COLOR = legacyStyles.themeBrandPrimary; 10export const DEFAULT_ACCENT_COLOR = themeBrandPrimary;
11 11
12export function theme(themeId: ThemeType, 12export function theme(themeId: ThemeType,
13 brandColor: string = DEFAULT_ACCENT_COLOR) { 13 brandColor: string = DEFAULT_ACCENT_COLOR) {