Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/ui-file-drop/src/FileDrop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ import {
import { accepts, getAcceptList } from './utils/accepts'
import { getEventFiles } from './utils/getEventFiles'

import { withStyleRework as withStyle } from '@instructure/emotion'
import { withStyle } from '@instructure/emotion'
import generateStyle from './styles'
import generateComponentTheme from './theme'

import { allowedProps } from './props'
import type { FileDropProps, FileDropState, FileDropStyleProps } from './props'

import type { FileDropProps, FileDropState } from './props'
import type { StyleParams } from './styles'
function keyEventIsClickButton(e: React.KeyboardEvent) {
return e.keyCode === keycode.codes.space || e.keyCode === keycode.codes.enter
}
Expand All @@ -54,7 +53,7 @@ category: components
---
**/
@withDeterministicId()
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle)
class FileDrop extends Component<FileDropProps, FileDropState> {
static readonly componentId = 'FileDrop'

Expand Down Expand Up @@ -90,8 +89,9 @@ class FileDrop extends Component<FileDropProps, FileDropState> {
else return fileLikeItem
}

makeStyleProps = (): FileDropStyleProps => {
makeStyleProps = (): StyleParams => {
return {
...this.props,
functionallyDisabled: this.functionallyDisabled,
visuallyDisabled: this.interaction === 'disabled',
dragRejected: this.state.isDragRejected || this.invalid,
Expand Down
20 changes: 12 additions & 8 deletions packages/ui-file-drop/src/FileDrop/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,33 @@
* SOFTWARE.
*/

import type { FileDropTheme } from '@instructure/shared-types'
import type { FileDropProps, FileDropStyleProps, FileDropStyle } from './props'
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'

type StyleParams = FileDropProps & FileDropStyleProps

/**
* ---
* private: true
* ---
* Generates the style object from the theme and provided additional information
* @param {Object} componentTheme The theme variable object.
* @param {Object} props the props of the component, the style is applied to
* @param {Object} state the state of the component, the style is applied to
* @param {Object} params the props and state of the component, the style is applied to
* @param {Object} sharedTokens Shared tokens from the theme
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: FileDropTheme,
props: FileDropProps,
state: FileDropStyleProps
componentTheme: NewComponentTypes['FileDrop'],
params: StyleParams,
_sharedTokens: SharedTokens
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: i think this param can just be omitted if not used

): FileDropStyle => {
const { height } = props
const {
height,
functionallyDisabled,
visuallyDisabled,
dragRejected,
dragAccepted
} = state
} = params

const dragAcceptedStyle = dragAccepted
? {
Expand Down Expand Up @@ -110,6 +112,7 @@ const generateStyle = (
fileDropLabelContent: {
label: 'fileDrop__labelContent',
display: 'block',
backgroundColor: componentTheme.backgroundColor,
Copy link
Contributor Author

@joyenjoyer joyenjoyer Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new token. View has to be migrated to the new theming system first so all of the docs examples will be working fine in dark themes (View is assigned to renderLabel that hides the original background).

boxSizing: 'border-box',
zIndex: 1,
textAlign: 'center',
Expand All @@ -134,3 +137,4 @@ const generateStyle = (
}

export default generateStyle
export type { StyleParams }
60 changes: 0 additions & 60 deletions packages/ui-file-drop/src/FileDrop/theme.ts

This file was deleted.

Loading