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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/JS-5460: Bookmark style update #973

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/scss/block/bookmark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,36 @@
.side.left { width: 100%; padding: 16px; position: relative; }
.side.right { border-radius: 0px 8px 8px 0px; overflow: hidden; display: none; }

.name { @include text-common; line-height: 20px; font-weight: 500; @include clamp2; margin-bottom: 2px; }
.descr { @include text-small; line-height: 16px; color: var(--color-text-secondary); margin-bottom: 4px; @include clamp2; }
.name { @include text-common; line-height: 20px; font-weight: 500; @include clamp2; }
.descr { @include text-small; line-height: 16px; color: var(--color-text-secondary); @include clamp2; }
.archive { position: absolute; right: 10px; top: 10px; z-index: 1; }
}

.inner.isVertical { display: flex; flex-direction: column-reverse; }
.inner.isVertical { display: flex; flex-direction: column; }
.inner.isVertical {
.side.left { width: 100%; border-radius: 0px; }
.side.right { aspect-ratio: 7/3; width: 100%; border-radius: 0px; border-bottom: 0.05em solid var(--color-shape-secondary); }
.side.right { aspect-ratio: 7/3; width: 100%; border-radius: 0px; }

.link,
.name { margin-bottom: 4px; }
.descr { @include clamp3; }
}

.inner.withImage {
.sides { align-items: stretch; }
.side.left { width: calc(100% - 28%); padding: 16px 12px 16px 16px; }
.side.right { width: 28%; min-height: 90px; display: block; position: relative; overflow: hidden; }
.side.right { width: 28%; min-height: 90px; display: flex; justify-content: flex-start; align-items: center; position: relative; overflow: hidden; }
.side.right {
.img { width: calc(100% - 16px); height: calc(100% - 32px); position: static; left: auto; top: auto; border-radius: 4px; }
}
}

.inner.withImage.isVertical {
.side.left { width: 100%; }
.side.right { width: 100%; }
.side.right { width: 100%; padding: 0px 16px 16px; aspect-ratio: unset; }
.side.right {
.img { width: 100%; height: auto; }
}
}

.link {
Expand All @@ -58,4 +68,4 @@

.block.blockBookmark > .wrapContent > .selectionTarget.isSelectionSelected::after { left: 0px; width: 100%; border-radius: 8px; }
.block.blockBookmark.withContent > .wrapContent > .selectionTarget.isSelectionSelected::after { border-radius: 8px; }
}
}
28 changes: 20 additions & 8 deletions src/scss/block/chat/attachment.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.attachments { display: flex; gap: 8px; flex-wrap: wrap; max-width: 540px; }
.attachments {
.attachment {
.attachments{
.attachment {
position: relative; border: 1px solid var(--color-shape-tertiary); background: var(--color-bg-primary); box-shadow: 0px 0px 4px rgba(0,0,0,0.05);
min-width: calc(532px / 2); width: calc(532px / 2); height: 72px; border-radius: 8px; display: flex; flex-direction: row; align-items: center;;
}
Expand All @@ -10,8 +10,8 @@
.iconObject { flex-shrink: 0; background-color: var(--color-shape-tertiary); border-radius: 6px; }
.info { flex-grow: 1; width: 100%; }

.icon.remove {
opacity: 0; transition: $transitionAllCommon; position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; background-size: 8px;
.icon.remove {
opacity: 0; transition: $transitionAllCommon; position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; background-size: 8px;
background-image: url('~img/icon/chat/buttons/remove.svg'); background-color: var(--color-bg-primary); border-radius: 50%;
box-shadow: 0px 1px 4px rgba(0,0,0,0.2);
}
Expand All @@ -23,14 +23,26 @@
}
}

.attachment.isFile, .attachment.isBookmark {
.attachment.isFile {
.iconObject { background-color: unset; }
.descr { display: flex; flex-direction: row; gap: 0px 6px; align-items: center; color: var(--color-text-secondary); }
}

.attachment.isBookmark { width: unset !important; height: unset; min-width: 200px; }
.attachment.isBookmark {
.url { @include text-overflow-nw; }
.info { display: flex; flex-direction: column; gap: 2px 0px; }
.inner { display: flex; flex-direction: column; padding: 16px; gap: 8px 0px; max-width: 360px; }
.inner {
.side.left { display: flex; flex-direction: column; gap: 4px 0px; width: 100%; align-items: flex-start; }
.side.left {
.link { @include text-small; color: var(--color-text-secondary); display: flex; justify-content: flex-start; align-items: center; gap: 0px 6px; }
.name { @include text-common; line-height: 20px; font-weight: 500; @include clamp2; }
.descr { @include text-small; line-height: 16px; color: var(--color-text-secondary); @include clamp3; }
}
.side.right { width: 328px; height: 172px; position: relative; display: flex; align-items: center; padding: 0px; background: none; border-radius: 4px; overflow: hidden; }
.side.right {
.img { object-fit: cover; width: 100%; height: 100%; }
}
}
}

.attachment.isImage { width: 72px; height: 72px; min-width: unset; display: flex; align-items: center; justify-content: center; }
Expand Down Expand Up @@ -118,4 +130,4 @@
.attachments.layout-10 {
.attachment { @include cnt-4; }
.attachment:nth-child(-n + 6) { @include cnt-3; }
}
}
6 changes: 3 additions & 3 deletions src/ts/component/block/bookmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ const BlockBookmark = observer(class BlockBookmark extends React.Component<I.Blo
{...U.Common.dataProps({ href: url })}
>
<div className={cnl.join(' ')}>
<ObjectName object={object} />
<ObjectDescription object={object} />
<div className="link">
{iconImage ? <img src={S.Common.imageUrl(iconImage, 16)} className="fav" /> : ''}
{U.Common.shortUrl(url)}
</div>
<ObjectName object={object} />
<ObjectDescription object={object} />

{archive}
</div>
Expand Down Expand Up @@ -274,4 +274,4 @@ const BlockBookmark = observer(class BlockBookmark extends React.Component<I.Blo

});

export default BlockBookmark;
export default BlockBookmark;
22 changes: 18 additions & 4 deletions src/ts/component/block/chat/attachment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,29 @@ const ChatAttachment = observer(class ChatAttachment extends React.Component<Pro

renderBookmark () {
const { object } = this.props;
const { picture, source } = object;
const cn = [ 'inner', 'isVertical' ];

if (picture) {
cn.push('withImage');
};

return (
<div className="clickable" onClick={this.onOpen}>
<div className="info">
<div className="descr">
<div
className={cn.join(' ')}
onClick={this.onOpen}
{...U.Common.dataProps({ href: source })}
>
<div className="side left">
<div className="link">
<IconObject object={object} size={14} />
<div className="url">{U.Common.shortUrl(object.source)}</div>
{U.Common.shortUrl(source)}
</div>
<ObjectName object={object} />
<ObjectDescription object={object} />
</div>
<div className="side right">
{picture ? <img src={S.Common.imageUrl(picture, 500)} className="img" /> : ''}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/ts/lib/api/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2214,4 +2214,4 @@ export const ChatGetMessagesByIds = (objectId: string, ids: string[], callBack?:
request.setMessageidsList(ids);

dispatcher.request(ChatGetMessagesByIds.name, request, callBack);
};
};
2 changes: 1 addition & 1 deletion src/ts/lib/util/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class UtilData {
};

chatRelationKeys () {
return J.Relation.default.concat([ 'source' ]);
return J.Relation.default.concat([ 'source', 'picture' ]);
};

createSession (phrase: string, key: string, callBack?: (message: any) => void) {
Expand Down
Loading