Skip to content

Commit

Permalink
remove csstype
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Aug 14, 2023
1 parent b49117c commit b791feb
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 33 deletions.
13 changes: 6 additions & 7 deletions packages/forms/src/button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Icon from '@mdi/react';
import { Theme } from '@meetfranz/theme';
import classnames from 'classnames';
import CSS from 'csstype';
import React, { Component } from 'react';
import injectStyle, { withTheme } from 'react-jss';
import Loader from 'react-loader';
Expand Down Expand Up @@ -34,13 +33,13 @@ const styles = (theme: Theme) => ({
borderRadius: theme.borderRadiusSmall,
border: 'none',
display: 'inline-flex',
position: 'relative' as CSS.PositionProperty,
position: 'relative',
transition: 'background .5s, opacity 0.3s',
textAlign: 'center' as CSS.TextAlignProperty,
textAlign: 'center',
outline: 'none',
alignItems: 'center',
padding: 0,
width: (props: IProps) => (props.stretch ? '100%' : 'auto') as CSS.WidthProperty<string>,
width: (props: IProps) => (props.stretch ? '100%' : 'auto'),
fontSize: theme.uiFontSize,
textDecoration: 'none',
// height: theme.buttonHeight,
Expand Down Expand Up @@ -113,7 +112,7 @@ const styles = (theme: Theme) => ({
opacity: theme.inputDisabledOpacity,
},
loader: {
position: 'relative' as CSS.PositionProperty,
position: 'relative',
width: 20,
height: 18,
zIndex: 9999,
Expand All @@ -125,7 +124,7 @@ const styles = (theme: Theme) => ({
transition: 'all 0.3s',
marginLeft: (props: IProps): number => !props.busy ? 10 : 20,
marginRight: (props: IProps): number => !props.busy ? -10 : -20,
position: (props: IProps): CSS.PositionProperty => props.stretch ? 'absolute' : 'inherit',
position: (props: IProps) => props.stretch ? 'absolute' : 'inherit',
},
icon: {
margin: [1, 10, 0, -5],
Expand Down Expand Up @@ -225,7 +224,7 @@ class ButtonComponent extends Component<IProps> {
wrapperComponent = (
<button
id={id}
type={type}
type={type as any}
onClick={onClick}
className={classnames({
[`${classes.button}`]: true,
Expand Down
3 changes: 1 addition & 2 deletions packages/forms/src/error/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Classes } from 'jss';
import React, { Component } from 'react';
import injectSheet from 'react-jss';

import styles from './styles';

interface IProps {
classes: Classes;
classes: any;
message: string;
}

Expand Down
5 changes: 2 additions & 3 deletions packages/forms/src/input/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Theme } from '@meetfranz/theme';
import CSS from 'csstype';

const prefixStyles = (theme: Theme) => ({
background: theme.inputPrefixBackground,
Expand All @@ -13,7 +12,7 @@ export default (theme: Theme) => ({
label: {
'& > div': {
marginTop: 5,
}
},
},
disabled: {
opacity: theme.inputDisabledOpacity,
Expand Down Expand Up @@ -85,7 +84,7 @@ export default (theme: Theme) => ({
background: theme.inputBackground,
border: theme.inputBorder,
borderRadius: theme.borderRadiusSmall,
boxSizing: 'border-box' as CSS.BoxSizingProperty,
boxSizing: 'border-box',
display: 'flex',
height: theme.inputHeight,
order: 1,
Expand Down
8 changes: 5 additions & 3 deletions packages/forms/src/label/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import classnames from 'classnames';
import { Classes } from 'jss';
import React, { Component } from 'react';
import injectSheet from 'react-jss';

Expand All @@ -8,7 +7,7 @@ import { IFormField } from '../typings/generic';
import styles from './styles';

interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> {
classes: Classes;
classes: any;
isRequired: boolean;
}

Expand Down Expand Up @@ -38,7 +37,10 @@ class LabelComponent extends Component<ILabel> {
htmlFor={htmlFor}
>
{showLabel && (
<span className={classes.label}>{title}{isRequired && ' *'}</span>
<span className={classes.label}>
{title}
{isRequired && ' *'}
</span>
)}
<div className={classes.content}>
{children}
Expand Down
3 changes: 1 addition & 2 deletions packages/forms/src/textarea/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Theme } from '@meetfranz/theme';
import CSS from 'csstype';

export default (theme: Theme) => ({
label: {
Expand Down Expand Up @@ -42,7 +41,7 @@ export default (theme: Theme) => ({
background: theme.inputBackground,
border: theme.inputBorder,
borderRadius: theme.borderRadiusSmall,
boxSizing: 'border-box' as CSS.BoxSizingProperty,
boxSizing: 'border-box',
display: 'flex',
order: 1,
width: '100%',
Expand Down
7 changes: 3 additions & 4 deletions packages/forms/src/toggle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Theme } from '@meetfranz/theme';
import classnames from 'classnames';
import CSS from 'csstype';
import React, { Component } from 'react';
import injectStyle from 'react-jss';

import { IFormField, IWithStyle, Omit } from '../typings/generic';
import { IFormField, IWithStyle } from '../typings/generic';

import { Error } from '../error';
import { Label } from '../label';
Expand All @@ -19,7 +18,7 @@ const styles = (theme: Theme) => ({
background: theme.toggleBackground,
borderRadius: theme.borderRadius,
height: theme.toggleHeight,
position: 'relative' as CSS.PositionProperty,
position: 'relative',
width: theme.toggleWidth,
},
button: {
Expand All @@ -30,7 +29,7 @@ const styles = (theme: Theme) => ({
height: theme.toggleHeight - 2,
left: 1,
top: 1,
position: 'absolute' as CSS.PositionProperty,
position: 'absolute',
transition: 'all .5s',
},
buttonActive: {
Expand Down
3 changes: 1 addition & 2 deletions packages/forms/src/typings/generic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Theme } from '@meetfranz/theme/lib';
import { Classes } from 'jss';

export interface IFormField {
showLabel?: boolean;
Expand All @@ -10,7 +9,7 @@ export interface IFormField {
}

export interface IWithStyle {
classes: Classes;
classes: any;
theme: Theme;
}

Expand Down
56 changes: 55 additions & 1 deletion packages/theme/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
},
"scripts": {
"dev": "tsc -w",
"build": "tsc",
"preprepare": "npm run test",
"test": "npx mocha"
"build": "tsc"
},
"bugs": {
"url": "https://github.com/meetfranz/franz/issues"
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/src/typings/generic.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Theme } from '@meetfranz/theme/lib';
import { Classes } from 'jss';

export interface IWithStyle {
classes: Classes;
classes: any;
theme: Theme;
}

Expand Down
3 changes: 3 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="node" />

declare module 'react-jss'
9 changes: 5 additions & 4 deletions uidev/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CSS from 'csstype';
import { Classes } from 'jss';
import { observer } from 'mobx-react';
import DevTools from 'mobx-react-devtools';
Expand All @@ -21,6 +20,7 @@ import './stories/toggle.stories';
import { store } from './stores';

import { theme, ThemeType } from '@meetfranz/theme';

const defaultTheme = theme(ThemeType.default);

const styles = {
Expand All @@ -35,7 +35,7 @@ const styles = {
},
menu: {
width: 300,
position: 'fixed' as CSS.PositionProperty,
position: 'fixed',
listStyleType: 'none',
fontSize: 14,
overflow: 'scroll',
Expand Down Expand Up @@ -66,7 +66,7 @@ const styles = {
borderBottom: '1px solid #CFCFCF',
},
sectionLink: {
fontWeight: 'bold' as CSS.FontWeightProperty,
fontWeight: 'bold',
color: '#000',
textDecoration: 'none',
},
Expand All @@ -81,7 +81,8 @@ export const App = injectSheet(styles)(observer(({ classes }: { classes: Classes
<ul className={classes.menu}>
{store.stories.sections.map((section, key) => (
<li key={key}>
<a href={`#section-${key}`} className={classes.sectionLink}>{
<a href={`#section-${key}`} className={classes.sectionLink}>
{
section.name}
</a>
<ul className={classes.storyList}>
Expand Down

0 comments on commit b791feb

Please sign in to comment.