Skip to content

Commit

Permalink
fix(CozyTheme): Set default variant to "normal"
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Jul 24, 2023
1 parent 151d23c commit 816034d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions react/CozyTheme/index.jsx
@@ -1,11 +1,14 @@
import React, { createContext, useContext } from 'react'
import PropTypes from 'prop-types'
import cx from 'classnames'

import MuiCozyTheme from '../MuiCozyTheme'

export const CozyThemeContext = createContext()

const CozyTheme = ({ variant, children, className }) => (
export const useCozyTheme = () => useContext(CozyThemeContext)

const CozyTheme = ({ variant, className, children }) => (
<CozyThemeContext.Provider value={variant}>
<MuiCozyTheme variant={variant}>
<div
Expand All @@ -19,6 +22,14 @@ const CozyTheme = ({ variant, children, className }) => (
</CozyThemeContext.Provider>
)

export const useCozyTheme = () => useContext(CozyThemeContext)
CozyTheme.propTypes = {
variant: PropTypes.oneOf(['normal', 'inverted']),
className: PropTypes.string,
children: PropTypes.node
}

CozyTheme.defaultProps = {
variant: 'normal'
}

export default CozyTheme
4 changes: 2 additions & 2 deletions react/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap
Expand Up @@ -153,7 +153,7 @@ exports[`SquareAppIcon component should render correctly an app in add state 1`]
data-testid="square-app-icon"
>
<div
class=""
class="CozyTheme--normal"
>
<span
class="MuiBadge-root-195"
Expand Down Expand Up @@ -268,7 +268,7 @@ exports[`SquareAppIcon component should render correctly an app in ghost state 1
data-testid="square-app-icon"
>
<div
class=""
class="CozyTheme--normal"
>
<span
class="MuiBadge-root-133"
Expand Down

0 comments on commit 816034d

Please sign in to comment.