chore: update share memo image (#482)

This commit is contained in:
boojack 2022-11-17 21:01:26 +08:00 committed by GitHub
parent c89a6665b6
commit a24b885236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 66 additions and 104 deletions

View File

@ -3,12 +3,24 @@ import Icon from "./Icon";
import "../less/memo-resources.less"; import "../less/memo-resources.less";
interface Props { interface Props {
className?: string;
resourceList: Resource[]; resourceList: Resource[];
className?: string;
style?: "row" | "col";
} }
const getDefaultProps = (): Props => {
return {
className: "",
style: "row",
resourceList: [],
};
};
const MemoResources: React.FC<Props> = (props: Props) => { const MemoResources: React.FC<Props> = (props: Props) => {
const { className, resourceList } = props; const { className, style, resourceList } = {
...getDefaultProps(),
...props,
};
const imageList = resourceList.filter((resource) => resource.type.includes("image")); const imageList = resourceList.filter((resource) => resource.type.includes("image"));
const otherResourceList = resourceList.filter((resource) => !resource.type.includes("image")); const otherResourceList = resourceList.filter((resource) => !resource.type.includes("image"));
@ -24,7 +36,7 @@ const MemoResources: React.FC<Props> = (props: Props) => {
return ( return (
<div className={`resource-wrapper ${className || ""}`}> <div className={`resource-wrapper ${className || ""}`}>
{imageList.length > 0 && ( {imageList.length > 0 && (
<div className="images-wrapper"> <div className={`images-wrapper ${style}`}>
{imageList.map((resource, index) => ( {imageList.map((resource, index) => (
<Image className="memo-img" key={resource.id} imgUrls={imgUrls} index={index} /> <Image className="memo-img" key={resource.id} imgUrls={imgUrls} index={index} />
))} ))}

View File

@ -112,7 +112,7 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
<span className="time-text">{memo.createdAtStr}</span> <span className="time-text">{memo.createdAtStr}</span>
<div className="memo-content-wrapper"> <div className="memo-content-wrapper">
<MemoContent content={memo.content} displayConfig={{ enableExpand: false }} /> <MemoContent content={memo.content} displayConfig={{ enableExpand: false }} />
<MemoResources resourceList={memo.resourceList} /> <MemoResources style="col" resourceList={memo.resourceList} />
</div> </div>
<div className="watermark-container"> <div className="watermark-container">
<div className="userinfo-container"> <div className="userinfo-container">

View File

@ -1,3 +1,15 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@layer utilities {
/* Chrome, Safari and Opera */
.hide-scrollbar::-webkit-scrollbar {
display: none;
}
.hide-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}

View File

@ -1,15 +1,12 @@
@import "./mixin.less";
.dialog-wrapper { .dialog-wrapper {
@apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 z-100 overflow-x-hidden overflow-y-scroll bg-transparent transition-all; @apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 z-100 overflow-x-hidden overflow-y-scroll bg-transparent transition-all hide-scrollbar;
.hide-scroll-bar();
&.showup { &.showup {
background-color: rgba(0, 0, 0, 0.6); background-color: rgba(0, 0, 0, 0.6);
} }
&.showoff { &.showoff {
display: none; @apply hidden;
} }
> .dialog-container { > .dialog-container {

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.common-dialog { .common-dialog {
> .dialog-container { > .dialog-container {
@apply w-80; @apply w-80;

View File

@ -1,5 +1,3 @@
@import "../mixin.less";
.selector-wrapper { .selector-wrapper {
@apply flex flex-col justify-start items-start relative h-8; @apply flex flex-col justify-start items-start relative h-8;
@ -26,11 +24,10 @@
} }
> .items-wrapper { > .items-wrapper {
@apply flex flex-col justify-start items-start absolute top-full left-0 w-auto p-1 mt-1 -ml-2 bg-white rounded-md overflow-y-auto z-1; @apply flex flex-col justify-start items-start absolute top-full left-0 w-auto p-1 mt-1 -ml-2 bg-white rounded-md overflow-y-auto z-1 hide-scrollbar;
min-width: calc(100% + 16px); min-width: calc(100% + 16px);
max-height: 256px; max-height: 256px;
box-shadow: 0 0 8px 0 rgb(0 0 0 / 20%); box-shadow: 0 0 8px 0 rgb(0 0 0 / 20%);
.hide-scroll-bar();
> .item-container { > .item-container {
@apply flex flex-col justify-start items-start w-full px-3 text-sm select-none leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100; @apply flex flex-col justify-start items-start w-full px-3 text-sm select-none leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.daily-memo-wrapper { .daily-memo-wrapper {
@apply flex flex-row justify-start items-start relative w-full flex-nowrap pb-6; @apply flex flex-row justify-start items-start relative w-full flex-nowrap pb-6;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.daily-review-dialog { .daily-review-dialog {
@apply p-0 sm:py-16; @apply p-0 sm:py-16;

View File

@ -1,12 +1,9 @@
@import "./mixin.less";
.common-editor-wrapper { .common-editor-wrapper {
@apply flex flex-col justify-start items-start relative w-full h-auto bg-white; @apply flex flex-col justify-start items-start relative w-full h-auto bg-white;
> .common-editor-inputer { > .common-editor-inputer {
@apply w-full h-full my-1 text-base resize-none overflow-x-hidden overflow-y-auto bg-transparent whitespace-pre-wrap; @apply w-full h-full my-1 text-base resize-none overflow-x-hidden overflow-y-auto bg-transparent whitespace-pre-wrap;
max-height: 300px; max-height: 300px;
.pretty-scroll-bar(2px, 0);
&::placeholder { &::placeholder {
padding-left: 2px; padding-left: 2px;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
body, body,
html { html {
@apply text-base; @apply text-base;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.page-wrapper.home { .page-wrapper.home {
@apply relative top-0 w-full h-screen overflow-y-auto overflow-x-hidden; @apply relative top-0 w-full h-screen overflow-y-auto overflow-x-hidden;
background-color: #f6f5f4; background-color: #f6f5f4;

View File

@ -1,16 +1,11 @@
@import "./mixin.less";
.image-container { .image-container {
width: 200px; width: 200px;
height: auto; height: auto;
overflow-y: scroll; overflow-y: scroll;
cursor: pointer; cursor: pointer;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
.pretty-scroll-bar(2px, 0);
> img { > img {
margin: auto; @apply m-auto w-full h-auto;
width: 100%;
height: auto;
} }
} }

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.memo-content-wrapper { .memo-content-wrapper {
@apply w-full flex flex-col justify-start items-start; @apply w-full flex flex-col justify-start items-start;

View File

@ -1,8 +1,5 @@
@import "./mixin.less";
.memo-list-container { .memo-list-container {
@apply flex flex-col justify-start items-start w-full max-w-full overflow-y-scroll !pb-36; @apply flex flex-col justify-start items-start w-full max-w-full overflow-y-scroll !pb-36 hide-scrollbar;
.hide-scroll-bar();
> .status-text-container { > .status-text-container {
@apply flex flex-col justify-start items-center w-full my-6; @apply flex flex-col justify-start items-center w-full my-6;

View File

@ -1,17 +1,38 @@
@import "./mixin.less";
.resource-wrapper { .resource-wrapper {
@apply w-full flex flex-col justify-start items-start; @apply w-full flex flex-col justify-start items-start;
> .images-wrapper { > .images-wrapper {
@apply flex flex-row justify-start items-start mt-2 w-full overflow-x-auto overflow-y-hidden pb-1; @apply w-full flex mt-2 pb-1;
> .memo-img { > .memo-img {
@apply mr-2 last:mr-0 w-auto h-auto shrink-0 grow-0 overflow-y-hidden; @apply w-auto h-auto shrink-0 grow-0;
.hide-scroll-bar();
> img { > img {
@apply w-auto max-h-40 rounded; @apply rounded;
}
}
&.row {
@apply flex-row justify-start items-start overflow-x-auto overflow-y-hidden;
> .memo-img {
@apply mr-2 last:mr-0;
> img {
@apply w-auto max-h-40;
}
}
}
&.col {
@apply flex-col justify-start items-start;
> .memo-img {
@apply w-full h-auto shrink-0 mb-2 last:mb-0 hide-scrollbar;
> img {
@apply w-full h-auto;
}
} }
} }
} }

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.memo-wrapper { .memo-wrapper {
@apply relative flex flex-col justify-start items-start w-full p-4 pt-3 mt-2 bg-white rounded-lg border border-white hover:border-gray-200; @apply relative flex flex-col justify-start items-start w-full p-4 pt-3 mt-2 bg-white rounded-lg border border-white hover:border-gray-200;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.section-header-container, .section-header-container,
.memos-header-container { .memos-header-container {
@apply sticky top-4 flex flex-row justify-between items-center w-full h-10 flex-nowrap mt-4 mb-2 shrink-0 z-1; @apply sticky top-4 flex flex-row justify-between items-center w-full h-10 flex-nowrap mt-4 mb-2 shrink-0 z-1;

View File

@ -1,28 +0,0 @@
.hide-scroll-bar {
.pretty-scroll-bar(0, 0);
&::-webkit-scrollbar {
display: none;
}
}
.pretty-scroll-bar(@width: 0px, @height: 0px) {
scrollbar-width: none;
&::-webkit-scrollbar {
width: @width;
height: @height;
cursor: pointer;
}
&::-webkit-scrollbar-thumb {
width: @width;
height: @height;
border-radius: 8px;
background-color: #d5d5d5;
&:hover {
background-color: #ccc;
}
}
}

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.preview-image-dialog { .preview-image-dialog {
@apply p-0; @apply p-0;
z-index: 101; z-index: 101;
@ -22,9 +20,8 @@
} }
> .img-container { > .img-container {
@apply w-full h-full p-4 flex flex-col justify-center items-center; @apply w-full h-full p-4 flex flex-col justify-center items-center hide-scrollbar;
background-color: unset; background-color: unset;
.hide-scroll-bar();
> img { > img {
@apply h-auto w-auto max-w-full max-h-full shadow; @apply h-auto w-auto max-w-full max-h-full shadow;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.resources-dialog { .resources-dialog {
@apply px-4; @apply px-4;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.search-bar-container { .search-bar-container {
@apply relative w-auto; @apply relative w-auto;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.setting-dialog { .setting-dialog {
@apply px-4; @apply px-4;
@ -7,8 +5,7 @@
@apply w-180 max-w-full mb-8 p-0; @apply w-180 max-w-full mb-8 p-0;
> .dialog-content-container { > .dialog-content-container {
@apply flex flex-col sm:flex-row justify-start items-start relative w-full overflow-y-scroll p-0; @apply flex flex-col sm:flex-row justify-start items-start relative w-full overflow-y-scroll p-0 hide-scrollbar;
.hide-scroll-bar();
> .close-btn { > .close-btn {
@apply z-1 flex flex-col justify-center items-center absolute top-4 right-4 w-6 h-6 rounded bg-white hover:bg-gray-200 hover:shadow; @apply z-1 flex flex-col justify-center items-center absolute top-4 right-4 w-6 h-6 rounded bg-white hover:bg-gray-200 hover:shadow;
@ -39,8 +36,7 @@
} }
> .section-content-container { > .section-content-container {
@apply w-full sm:w-auto p-4 sm:px-6 grow flex flex-col justify-start items-start h-128 overflow-y-scroll; @apply w-full sm:w-auto p-4 sm:px-6 grow flex flex-col justify-start items-start h-128 overflow-y-scroll hide-scrollbar;
.hide-scroll-bar();
> .section-container { > .section-container {
@apply flex flex-col justify-start items-start w-full my-2; @apply flex flex-col justify-start items-start w-full my-2;

View File

@ -1,5 +1,3 @@
@import "./mixin.less";
.share-memo-image-dialog { .share-memo-image-dialog {
> .dialog-container { > .dialog-container {
@apply w-96 p-0 bg-gray-200; @apply w-96 p-0 bg-gray-200;

View File

@ -1,8 +1,5 @@
@import "./mixin.less";
.shortcuts-wrapper { .shortcuts-wrapper {
@apply flex flex-col justify-start items-start w-full py-0 px-2 mt-2 h-auto shrink-0 flex-nowrap; @apply flex flex-col justify-start items-start w-full py-0 px-2 mt-2 h-auto shrink-0 flex-nowrap hide-scrollbar;
.hide-scroll-bar();
> .title-text { > .title-text {
@apply flex flex-row justify-start items-center w-full px-4; @apply flex flex-row justify-start items-center w-full px-4;

View File

@ -1,8 +1,5 @@
@import "./mixin.less";
.sidebar-wrapper { .sidebar-wrapper {
@apply fixed sm:sticky top-0 z-30 sm:z-0 -translate-x-64 sm:translate-x-0 sm:flex flex-col justify-start items-start w-64 h-screen py-4 pl-2 bg-white sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain; @apply fixed sm:sticky top-0 z-30 sm:z-0 -translate-x-64 sm:translate-x-0 sm:flex flex-col justify-start items-start w-64 h-screen py-4 pl-2 bg-white sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain hide-scrollbar;
.hide-scroll-bar();
&.show { &.show {
@apply translate-x-0 shadow-2xl sm:shadow-none; @apply translate-x-0 shadow-2xl sm:shadow-none;

View File

@ -1,8 +1,5 @@
@import "./mixin.less";
.tags-wrapper { .tags-wrapper {
@apply flex flex-col justify-start items-start px-2 w-full h-auto flex-nowrap pb-4 mt-2 grow; @apply flex flex-col justify-start items-start px-2 w-full h-auto flex-nowrap pb-4 mt-2 grow hide-scrollbar;
.hide-scroll-bar();
> .title-text { > .title-text {
@apply w-full px-4 text-sm leading-6 font-mono text-gray-400; @apply w-full px-4 text-sm leading-6 font-mono text-gray-400;