Skip to content

Commit

Permalink
fix(styles): eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MM25Zamanian committed Mar 6, 2024
1 parent 461bd92 commit 036e121
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions packages/styles/src/plugins/state-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,53 @@ const stateOpacity = {

export const stateLayerPlugin = plugin(({ matchUtilities, theme }) => {
matchUtilities(
{
state: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const colors = {
base: makeColor({ opacityValue: 1 }),
hover: makeColor({ opacityValue: stateOpacity.hover }),
focus: makeColor({ opacityValue: stateOpacity.focus }),
pressed: makeColor({ opacityValue: stateOpacity.pressed })
};
{
state: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const colors = {
base: makeColor({ opacityValue: 1 }),
hover: makeColor({ opacityValue: stateOpacity.hover }),
focus: makeColor({ opacityValue: stateOpacity.focus }),
pressed: makeColor({ opacityValue: stateOpacity.pressed })
};

return {
color: colors.base,
'&:hover': {
backgroundImage: `linear-gradient(${colors.hover}, ${colors.hover})`
},
'&:active': {
backgroundImage: `linear-gradient(${colors.pressed}, ${colors.pressed})`
},
'&:focus:not(:hover), &:focus-within:not(:hover)': {
backgroundImage: `linear-gradient(${colors.focus}, ${colors.focus})`
}
};
},
stateHover: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const color = makeColor({ opacityValue: stateOpacity.hover });

return {
backgroundImage: `linear-gradient(${color}, ${color})`
};
},
stateActive: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const color = makeColor({ opacityValue: stateOpacity.pressed });
return {
color: colors.base,
'&:hover': {
backgroundImage: `linear-gradient(${colors.hover}, ${colors.hover})`
},
'&:active': {
backgroundImage: `linear-gradient(${colors.pressed}, ${colors.pressed})`
},
'&:focus:not(:hover), &:focus-within:not(:hover)': {
backgroundImage: `linear-gradient(${colors.focus}, ${colors.focus})`
}
};
},
stateHover: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const color = makeColor({ opacityValue: stateOpacity.hover });

return {
backgroundImage: `linear-gradient(${color}, ${color})`
};
}
return {
backgroundImage: `linear-gradient(${color}, ${color})`
};
},
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('colors'))),
type: 'color'
stateActive: (value) => {
if (typeof value !== 'function') return null;
const makeColor = value as unknown as (options: {opacityValue: number}) => string;
const color = makeColor({ opacityValue: stateOpacity.pressed });

return {
backgroundImage: `linear-gradient(${color}, ${color})`
};
}
},
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('colors'))),
type: 'color'
}
);
});

0 comments on commit 036e121

Please sign in to comment.