Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
List block v2: use default color for preferred color scheme
  • Loading branch information
derekblank committed Aug 15, 2022
commit 74eb97aa09bd622a7fbfc0bbd995edce9f67ebe8
14 changes: 12 additions & 2 deletions packages/block-library/src/list-item/list-style-type.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { View, Text } from 'react-native';
*/
import { Icon } from '@wordpress/components';
import { Platform } from '@wordpress/element';
import { withPreferredColorScheme } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -89,9 +90,10 @@ function IconList( { fontSize, color, defaultFontSize, indentationLevel } ) {
);
}

export default function ListStyleType( {
function ListStyleType( {
blockIndex,
indentationLevel,
getStylesFromColorScheme,
numberOfListItems,
ordered,
reversed,
Expand All @@ -109,9 +111,15 @@ export default function ListStyleType( {
style?.fontSize ? style.fontSize : defaultFontSize,
10
);

const colorWithPreferredScheme = getStylesFromColorScheme(
styles[ 'wp-block-list-item__list-item--default' ],
styles[ 'wp-block-list-item__list-item--default--dark' ]
);

const defaultColor = style?.baseColors?.color?.text
? style.baseColors.color.text
: styles[ 'wp-block-list-item__list-item--default' ].color;
: colorWithPreferredScheme.color;
const color = style?.color ? style.color : defaultColor;

if ( ordered ) {
Expand All @@ -137,3 +145,5 @@ export default function ListStyleType( {
/>
);
}

export default withPreferredColorScheme( ListStyleType );
5 changes: 5 additions & 0 deletions packages/block-library/src/list-item/style.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
font-size: $editor-font-size;
}

.wp-block-list-item__list-item--default--dark {
color: $white;
font-size: $editor-font-size;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick we can remove the font-size here as it would use the value from wp-block-list-item__list-item--default

}

.wp-block-list-item__list-item-ordered--default {
margin-top: 2;
}
Expand Down