Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
Add focus styles (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
musingh1 authored Sep 26, 2018
1 parent 7f70b3a commit 7e186cc
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/themes/teams/components/List/listItemStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ import { pxToRem } from '../../../../lib'
import { IComponentPartStylesInput, ICSSInJSStyle } from '../../../../../types/theme'
import { IListItemProps } from '../../../../components/List/ListItem'

const hoverStyle = variables => ({
background: variables.selectionHoverBackgroundColor,
color: variables.selectionHoverColor,
cursor: 'pointer',

'& .ui-item-layout__header': { color: 'inherit' },
'& .ui-item-layout__content': { color: 'inherit' },

// hide the header media and content media on hover
'& .ui-item-layout__headerMedia': { display: 'none', color: 'inherit' },
'& .ui-item-layout__contentMedia': { display: 'none', color: 'inherit' },

// show the end media on hover
'& .ui-item-layout__endMedia': { display: 'unset', color: 'inherit' },
})

const listItemStyles: IComponentPartStylesInput<IListItemProps, any> = {
root: ({ props: { selection, important }, variables }): ICSSInJSStyle => ({
...(selection && {
Expand All @@ -10,21 +26,8 @@ const listItemStyles: IComponentPartStylesInput<IListItemProps, any> = {
// show the end media on hover
'& .ui-item-layout__endMedia': { display: 'none' },

':hover': {
background: variables.selectionHoverBackgroundColor,
color: variables.selectionHoverColor,
cursor: 'pointer',

'& .ui-item-layout__header': { color: 'inherit' },
'& .ui-item-layout__content': { color: 'inherit' },

// hide the header media and content media on hover
'& .ui-item-layout__headerMedia': { display: 'none', color: 'inherit' },
'& .ui-item-layout__contentMedia': { display: 'none', color: 'inherit' },

// show the end media on hover
'& .ui-item-layout__endMedia': { display: 'unset', color: 'inherit' },
},
'&:hover': hoverStyle(variables),
'&:focus': hoverStyle(variables),
}),
...(important && {
fontWeight: 'bold',
Expand Down

0 comments on commit 7e186cc

Please sign in to comment.