Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block: Fix issues with rearranging stories in Firefox #12708

Merged
merged 8 commits into from
Nov 28, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function ItemOverlay({
story,
addSelectedStory,
removeSelectedStory,
isSelectable,
}) {
const onClickOverlay = useCallback(
(event) => {
Expand Down Expand Up @@ -58,6 +59,10 @@ function ItemOverlay({
[removeSelectedStory, addSelectedStory, story, isSelected]
);

if (!isSelectable) {
return <div className="web-stories-story-preview-card__overlay" />;
}

return (
<button
type="button"
Expand Down Expand Up @@ -88,6 +93,7 @@ ItemOverlay.propTypes = {
story: PropTypes.object.isRequired,
addSelectedStory: PropTypes.func,
removeSelectedStory: PropTypes.func,
isSelectable: PropTypes.bool,
};

export default ItemOverlay;
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function SortStories({ selectedStories, setSelectedStories }) {
data-order={index}
draggable
>
<StoryPreview story={story} />
<StoryPreview story={story} isSelectable={false} />
</div>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function StoryPreview({
isSelected,
addSelectedStory = noop,
removeSelectedStory = noop,
isSelectable = true,
}) {
// @todo Keep an eye on this experimental API, make necessary changes when this gets updated in core.
const dateFormat = __experimentalGetSettings().formats.date;
Expand Down Expand Up @@ -83,6 +84,7 @@ function StoryPreview({
story={story}
addSelectedStory={addSelectedStory}
removeSelectedStory={removeSelectedStory}
isSelectable={isSelectable}
/>
{posterImage && (
<img src={posterImage} alt="" width={640} height={853} />
Expand All @@ -108,6 +110,7 @@ StoryPreview.propTypes = {
isSelected: PropTypes.bool,
addSelectedStory: PropTypes.func,
removeSelectedStory: PropTypes.func,
isSelectable: PropTypes.bool,
};

export default StoryPreview;