Skip to content

Commit

Permalink
fix(imagefield): blinking on hover when using position absolut fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
schettn authored Sep 15, 2021
1 parent 0ddd13c commit d45c6f9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
8 changes: 7 additions & 1 deletion examples/my-gatsby-site/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ const IndexPage = () => {
alt: 'ta',
title: 'daa'
}}
style={{width: '100%'}}
style={{
width: '50%',
position: 'absolute',
height: '50vh',
top: 0,
left: 0
}}
/>
<BlockContainer
name="blockcontainer1"
Expand Down
23 changes: 17 additions & 6 deletions packages/jaen-pages/src/containers/JaenImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
} from 'gatsby-plugin-image'
import * as React from 'react'

import {JaenImageContainer} from './style'

const SnekFinder = loadable(() => import('@containers/SnekFinder'))

export type ImageType = {
Expand Down Expand Up @@ -51,20 +49,33 @@ const JaenImage: React.FC<JaenImage> = ({

const image = storeImage || initialImage

const editingStyle = editable
? {
cursor: 'pointer',
boxShadow: '0 0 0 2.5px #48BB78',
transition: 'box-shadow 0.1s ease-in-out'
}
: {}

const imageProps = {
...props.imageProps,
style: {...props.imageProps.style, ...editingStyle}
}

return (
<>
<JaenImageContainer editable={editable} onClick={handleFileClick}>
<div onClick={handleFileClick}>
{storeImage || !contextImage ? (
<Image {...props.imageProps} {...image} />
<Image {...imageProps} {...image} />
) : (
<GatsbyImage
image={contextImage}
title={image.title}
alt={image.alt}
{...props.imageProps}
{...imageProps}
/>
)}
</JaenImageContainer>
</div>
{fileSelector.isOpen && (
<SnekFinder
mode="selector"
Expand Down
8 changes: 0 additions & 8 deletions packages/jaen-pages/src/containers/JaenImage/style.ts

This file was deleted.

0 comments on commit d45c6f9

Please sign in to comment.