Skip to content

Commit

Permalink
Cleanup code (#168)
Browse files Browse the repository at this point in the history
* added missing styles to message

* added missing prefix to `ModalProps`

* added missing `hashPriority` to style definitions

* Apply eslint-fixer changes

* Automatic frontend build

---------

Co-authored-by: Corepex <[email protected]>
  • Loading branch information
Corepex and Corepex authored Mar 28, 2024
1 parent bfaa0b2 commit 4689f32
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion assets/js/src/components/background/background.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ export const useStyle = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/example/example.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const useStyle = createStyles(({ token, css }) => {
color: ${token.Example.color};
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/grid/grid.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/grid/resizer/resizer.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/logo/logo.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const useStlyes = createStyles(({ token, css }) => {
padding: 13px 16px 0 16px;
`
}
})
}, { hashPriority: 'low' })
8 changes: 7 additions & 1 deletion assets/js/src/components/message/useMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import {
} from 'antd/es/message/interface'
import { Icon } from '@Pimcore/components/icon/icon'
import React from 'react'
import { useStyle } from '@Pimcore/components/message/message.style'

export const useMessage = (messageConfig?: ConfigOptions): readonly [MessageInstance, React.ReactElement] => {
const [messageApi, contextHolder] = message.useMessage(messageConfig)
const { styles } = useStyle()

messageApi.info = (content: JointContent, duration?: number | VoidFunction, onClose?: VoidFunction): MessageType => {
let config: ArgsProps
Expand All @@ -35,11 +37,15 @@ export const useMessage = (messageConfig?: ConfigOptions): readonly [MessageInst
if (config.type === 'info') {
return message.open({
icon: <Icon name={'info-circle-filled'} options={{ width: '16px', height: '16px' }} />,
className: styles.message,
...config
})
}

return message.open(config)
return message.open({
className: styles.message,
...config
})
}

return [messageApi, contextHolder]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const useStyle = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const useStyle = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/modal/modal.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ export const useStyle = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
4 changes: 2 additions & 2 deletions assets/js/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import React from 'react'
import { useStyle } from '@Pimcore/components/modal/modal.styles'
import type useModal from 'antd/es/modal/useModal'

export interface ModalProps extends AntModalProps {
export interface IModalProps extends AntModalProps {
icon?: React.JSX.Element
footer?: React.JSX.Element
useModal?: typeof useModal
children: React.ReactNode
}

export const Modal = (props: ModalProps): React.JSX.Element => {
export const Modal = (props: IModalProps): React.JSX.Element => {
const { styles } = useStyle()
const { children } = props

Expand Down
14 changes: 7 additions & 7 deletions assets/js/src/components/modal/useModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react'
import { Modal, type ModalProps } from '@Pimcore/components/modal/modal'
import { Modal, type IModalProps } from '@Pimcore/components/modal/modal'
import { Icon } from '@Pimcore/components/icon/icon'

interface useModalReturnType {
renderModal: (props: ModalProps) => React.JSX.Element
renderModal: (props: IModalProps) => React.JSX.Element
showModal: () => void
handleOk: () => void
handleCancel: () => void
Expand Down Expand Up @@ -45,7 +45,7 @@ export const useModal = (config = { type: 'default' }): useModalReturnType => {
return component
}

function renderModal (props: ModalProps): React.JSX.Element {
function renderModal (props: IModalProps): React.JSX.Element {
const { children, ...inlineProps } = props
const ModalComponent = getModalComponent(config.type)

Expand All @@ -65,7 +65,7 @@ export const useModal = (config = { type: 'default' }): useModalReturnType => {
}

export const withError = (Component: typeof Modal): typeof Modal => {
const modalWithError = (props: ModalProps): React.JSX.Element => {
const modalWithError = (props: IModalProps): React.JSX.Element => {
const { children, ...inlineProps } = props

return (
Expand All @@ -83,7 +83,7 @@ export const withError = (Component: typeof Modal): typeof Modal => {
}

export const withSuccess = (Component: typeof Modal): typeof Modal => {
const modalWithSuccess = (props: ModalProps): React.JSX.Element => {
const modalWithSuccess = (props: IModalProps): React.JSX.Element => {
const { children, ...inlineProps } = props

return (
Expand All @@ -101,7 +101,7 @@ export const withSuccess = (Component: typeof Modal): typeof Modal => {
}

export const withInfo = (Component: typeof Modal): typeof Modal => {
const modalWithInfo = (props: ModalProps): React.JSX.Element => {
const modalWithInfo = (props: IModalProps): React.JSX.Element => {
const { children, ...inlineProps } = props

return (
Expand All @@ -119,7 +119,7 @@ export const withInfo = (Component: typeof Modal): typeof Modal => {
}

export const withWarn = (Component: typeof Modal): typeof Modal => {
const modalWithWarn = (props: ModalProps): React.JSX.Element => {
const modalWithWarn = (props: IModalProps): React.JSX.Element => {
const { children, ...inlineProps } = props

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const useStyle = createStyles(({ token, css }) => {
left: calc(50% - 8px);
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/tree/list/tree-list.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/tree/node/tree-node.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/components/tree/tree.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const useStyles = createStyles(({ token, css }) => {
color: ${token.colorTextTreeElement}
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const useStyles = createStyles(({ token, css }) => {
width: 80px;
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const useStyles = createStyles(({ css, token }) => {
justify-content: space-between;
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const useStyles = createStyles(({ css, token }) => {
align-self: baseline;
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const useStlyes = createStyles(({ token, css }) => {
inset: 0;
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export const useStlyes = createStyles(({
}
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export const useStlyes = createStyles(({
.logo
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ export const useStlyes = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/modules/widget/title/title-view.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const useStyles = createStyles(({ token, css }) => {
font-weight: 600;
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion assets/js/src/modules/widget/widget-view.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const useStyles = createStyles(({ token, css }) => {
}
`
}
})
}, { hashPriority: 'low' })
2 changes: 1 addition & 1 deletion public/build/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"main": {
"js": [
"/bundles/pimcorestudioui/build/521.97212067.js",
"/bundles/pimcorestudioui/build/main.e75a1e92.js"
"/bundles/pimcorestudioui/build/main.b2652009.js"
],
"css": [
"/bundles/pimcorestudioui/build/main.3691bcd8.css"
Expand Down
1 change: 1 addition & 0 deletions public/build/main.b2652009.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/main.e75a1e92.js

This file was deleted.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bundles/pimcorestudioui/build/main.css": "/bundles/pimcorestudioui/build/main.3691bcd8.css",
"bundles/pimcorestudioui/build/main.js": "/bundles/pimcorestudioui/build/main.e75a1e92.js",
"bundles/pimcorestudioui/build/main.js": "/bundles/pimcorestudioui/build/main.b2652009.js",
"bundles/pimcorestudioui/build/58.9cf6e23a.js": "/bundles/pimcorestudioui/build/58.9cf6e23a.js",
"bundles/pimcorestudioui/build/678.c220b736.js": "/bundles/pimcorestudioui/build/678.c220b736.js",
"bundles/pimcorestudioui/build/625.b487b20e.js": "/bundles/pimcorestudioui/build/625.b487b20e.js",
Expand Down

0 comments on commit 4689f32

Please sign in to comment.