Skip to content
Open
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
20 changes: 13 additions & 7 deletions packages/ui-list/src/InlineList/InlineListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ import { Component } from 'react'

import { View } from '@instructure/ui-view'
import { passthroughProps } from '@instructure/ui-react-utils'

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 { InlineListItemProps } from './props'

Expand All @@ -41,7 +38,7 @@ parent: InlineList
id: InlineList.Item
---
**/
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle, 'InlineListInlineListItem')
class InlineListItem extends Component<InlineListItemProps> {
static readonly componentId = 'InlineList.Item'

Expand All @@ -67,11 +64,20 @@ class InlineListItem extends Component<InlineListItemProps> {
}

componentDidMount() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

componentDidUpdate() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

makeStyleProps = () => {
const { size, delimiter, spacing } = this.props
return {
size,
delimiter,
spacing
}
Comment on lines +74 to +80
Copy link
Contributor

@ToMESSKa ToMESSKa Dec 18, 2025

Choose a reason for hiding this comment

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

Is there any particular reason why you're extracting props in the index.ts files?

Copy link
Contributor Author

@git-nandor git-nandor Dec 18, 2025

Choose a reason for hiding this comment

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

This ensures that only the necessary props are passed to the theme.ts file for style generation. Similar to ui-rating, I think this is a clean and effective approach.

Copy link
Contributor

@ToMESSKa ToMESSKa Dec 19, 2025

Choose a reason for hiding this comment

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

@git-nandor I checked it and I cannot see a smiliar approach in ui-rating?

}

render() {
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-list/src/InlineList/InlineListItem/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import { logError as error } from '@instructure/console'

import type { InlineListItemTheme } from '@instructure/shared-types'
import type { NewComponentTypes } from '@instructure/ui-themes'
import type { InlineListItemProps, InlineListItemStyle } from './props'

/**
Expand All @@ -40,7 +40,7 @@ import type { InlineListItemProps, InlineListItemStyle } from './props'
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: InlineListItemTheme,
componentTheme: NewComponentTypes['InlineListInlineListItem'],
props: InlineListItemProps
): InlineListItemStyle => {
Comment on lines 42 to 45
Copy link
Contributor

Choose a reason for hiding this comment

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

I see a marginBottomDefault token in InlineListInlineListItem which I don't see here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The marginBottomDefault token will not be used, and the designers have already removed it in the latest version.

const { size, delimiter, spacing } = props
Expand Down
72 changes: 0 additions & 72 deletions packages/ui-list/src/InlineList/InlineListItem/theme.ts

This file was deleted.

16 changes: 8 additions & 8 deletions packages/ui-list/src/InlineList/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,49 +95,49 @@ type: example
---
<div>
<InlineList itemSpacing="xxx-small">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to xxx-small</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="xx-small">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to xx-small</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="x-small">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to x-small</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="small">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to small</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="medium">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to medium</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="large">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to large</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="x-large">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to x-large</Link></InlineList.Item>
</InlineList>
<InlineList itemSpacing="xx-large">
<InlineList.Item>{lorem.sentence()}</InlineList.Item>
<InlineList.Item>Adding predefined space</InlineList.Item>
<InlineList.Item>10pts</InlineList.Item>
<InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
<InlineList.Item><Link href="#">Set to xx-large</Link></InlineList.Item>
Expand Down
20 changes: 13 additions & 7 deletions packages/ui-list/src/List/ListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ import { Component } from 'react'

import { View } from '@instructure/ui-view'
import { passthroughProps } from '@instructure/ui-react-utils'

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 { ListItemProps } from './props'

Expand All @@ -41,7 +38,7 @@ parent: List
id: List.Item
---
**/
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle, 'ListListItem')
class ListItem extends Component<ListItemProps> {
static readonly componentId = 'List.Item'

Expand All @@ -66,11 +63,20 @@ class ListItem extends Component<ListItemProps> {
}

componentDidMount() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

componentDidUpdate() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

makeStyleProps = () => {
const { size, delimiter, spacing } = this.props
return {
size,
delimiter,
spacing
}
}

render() {
Expand Down
5 changes: 2 additions & 3 deletions packages/ui-list/src/List/ListItem/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
*/

import { logError as error } from '@instructure/console'

import type { ListItemTheme } from '@instructure/shared-types'
import type { NewComponentTypes } from '@instructure/ui-themes'
import type { ListItemProps, ListItemStyle } from './props'

/**
Expand All @@ -40,7 +39,7 @@ import type { ListItemProps, ListItemStyle } from './props'
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: ListItemTheme,
componentTheme: NewComponentTypes['ListListItem'],
props: ListItemProps
): ListItemStyle => {
const { size, delimiter, spacing } = props
Expand Down
68 changes: 0 additions & 68 deletions packages/ui-list/src/List/ListItem/theme.ts

This file was deleted.

20 changes: 12 additions & 8 deletions packages/ui-list/src/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ import { Children, Component, ReactElement } from 'react'

import { View } from '@instructure/ui-view'
import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils'
import { withStyle } from '@instructure/emotion'

import { ListItem } from './ListItem'

import { withStyleRework as withStyle } from '@instructure/emotion'

import generateStyle from './styles'
import generateComponentTheme from './theme'

import { allowedProps } from './props'
import type { ListProps } from './props'

Expand All @@ -42,7 +38,7 @@ import type { ListProps } from './props'
category: components
---
**/
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle)
class List extends Component<ListProps> {
static readonly componentId = 'List'

Expand Down Expand Up @@ -70,11 +66,19 @@ class List extends Component<ListProps> {
}

componentDidMount() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

componentDidUpdate() {
this.props.makeStyles?.()
this.props.makeStyles?.(this.makeStyleProps())
}

makeStyleProps = () => {
const { as, isUnstyled } = this.props
return {
as,
isUnstyled
}
}

renderChildren() {
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-list/src/List/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* SOFTWARE.
*/

import type { ListTheme } from '@instructure/shared-types'
import type { ListProps, ListStyle } from './props'
import type { NewComponentTypes } from '@instructure/ui-themes'

/**
* ---
Expand All @@ -36,7 +36,7 @@ import type { ListProps, ListStyle } from './props'
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: ListTheme,
componentTheme: NewComponentTypes['List'],
props: ListProps
): ListStyle => {
const { isUnstyled, as } = props
Expand Down
Loading
Loading