[Settings > Items] card: banner image using img (native lazyload, other tweaks), make authors not pointer cursor

pull/50/head
Oj18 3 years ago
parent 59209e5d70
commit 877b462b7f

@ -66,16 +66,11 @@ export default () => {
margin-left: -12px;
background-color: var(--background-secondary-alt);
background-repeat: no-repeat;
background-size: contain;
background-position: 50%;
text-align: center;
line-height: 200px;
object-fit: contain;
color: var(--interactive-normal);
font-family: var(--font-display);
font-size: 36px;
-webkit-user-drag: none;
user-select: none;
}
.gm-store-card > :nth-child(2) {
@ -91,6 +86,8 @@ export default () => {
width: fit-content;
padding-right: 10px;
cursor: default;
}
.gm-store-card > :nth-child(2).no-pfp {

@ -1,9 +1,6 @@
import _LazyBanner from './sub/lazyBanner';
export default () => {
const { React } = goosemod.webpackModules.common;
const LazyBanner = _LazyBanner();
const Button = goosemod.webpackModules.findByProps('Sizes', 'Colors', 'Looks', 'DropdownSizes');
const Switch = goosemod.webpackModules.findByDisplayName('Switch');
@ -29,26 +26,12 @@ return class Card extends React.PureComponent {
className: ['gm-store-card', this.props.mini ? 'gm-store-card-mini' : '', ...this.props.tags.map((x) => x.replace(/ /g, '|'))].join(' '),
onClick: this.props.onClick
},
/* React.createElement('div', {
style: {
backgroundImage: this.props.images?.length ? `url("${this.props.images[0]}")` : ''
},
onClick: () => {
if (!this.props.images?.length) return; // Ignore if no images
ModalHandler.openModal(() => React.createElement('div', {
className: 'gm-carousel-modal'
},
React.createElement(SmallMediaCarousel, {
items: this.props.images.map((x) => ({ type: 1, src: x })),
autoplayInterval: 5000 // Time between automatically cycling to next image
})
));
}
}), */
React.createElement('img', {
loading: 'lazy',
alt: '',
draggable: 'false',
React.createElement(LazyBanner, {
src: this.props.images?.[0],
onClick: () => {

@ -1,48 +0,0 @@
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
const image = entry.target;
image._lazyLoad();
observer.unobserve(image);
}
}
});
export default () => {
const { React, ReactDOM } = goosemod.webpackModules.common;
return class LazyBanner extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
loaded: false
};
}
componentDidMount() {
const node = ReactDOM.findDOMNode(this);
node._lazyLoad = () => {
this.setState({
loaded: true
});
};
observer.observe(node);
}
render() {
return React.createElement('div', {
style: {
backgroundImage: this.state.loaded ? `url("${this.props.src}")` : ''
},
onClick: this.props.onclick
});
}
};
};
Loading…
Cancel
Save