1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

Compare commits

...

2 commits

Author SHA1 Message Date
Fedor Katurov
42f8f96e34 only use new-comment tag if there's really new comment 2025-01-26 19:01:42 +07:00
Fedor Katurov
fd8907dd3a use container queries in flow 2025-01-26 18:58:49 +07:00
7 changed files with 69 additions and 27 deletions

View file

@ -22,7 +22,11 @@ const NodeHorizontalCard: FC<Props> = ({ node, hasNew, onClick }) => (
<Anchor <Anchor
key={node.id} key={node.id}
className={styles.item} className={styles.item}
href={getNewCommentAnchor(URLS.NODE_URL(node.id))} href={
hasNew
? getNewCommentAnchor(URLS.NODE_URL(node.id))
: URLS.NODE_URL(node.id)
}
onClick={onClick} onClick={onClick}
> >
<div <div

View file

@ -20,7 +20,7 @@ interface NotificationCommentProps {
const NotificationComment: FC<NotificationCommentProps> = ({ item, isNew }) => ( const NotificationComment: FC<NotificationCommentProps> = ({ item, isNew }) => (
<Anchor <Anchor
href={isNew ? getCommentAnchor(item.url, item.itemId) : item.url} href={getCommentAnchor(item.url, item.itemId)}
className={styles.link} className={styles.link}
> >
<div className={classNames(styles.message, { [styles.new]: isNew })}> <div className={classNames(styles.message, { [styles.new]: isNew })}>

View file

@ -1,11 +1,7 @@
@import "src/styles/variables"; @import 'src/styles/variables';
.recent { .recent {
@media (max-width: $flow_hide_recents) { @container sizer (width < #{$flow_hide_recents}) {
display: none; display: none;
} }
} }
.updates {
}

View file

@ -108,7 +108,7 @@
} }
.whatsnew { .whatsnew {
@media (max-width: $flow_hide_recents) { @container sizer (width < #{$flow_hide_recents}) {
display: none; display: none;
} }
} }

View file

@ -68,6 +68,7 @@ const NodeComments: FC<Props> = observer(({ order }) => {
return null; return null;
} }
/** Scrolls down to new comments or specific one from anchor */
useEffect(() => { useEffect(() => {
const anchor = location.hash?.replace('#', ''); const anchor = location.hash?.replace('#', '');

View file

@ -2,6 +2,19 @@
@import 'src/styles/variables'; @import 'src/styles/variables';
$target_flow_cell_width: 225px;
/** Makes a breakpoint for target cell width **/
@mixin breakpoint($columns) {
@container sizer (max-width: #{$target_flow_cell_width* $columns}) {
grid-template-columns: repeat(#{$columns}, 1fr);
grid-auto-rows: calc(
(100cqw - #{$columns - 1} * #{$gap} / 2) / #{$columns}
);
@content;
}
}
.wrap { .wrap {
max-width: 2000px; max-width: 2000px;
padding: 0 40px 40px 40px; padding: 0 40px 40px 40px;
@ -14,6 +27,7 @@ $cols: math.div($content_width, $cell);
.container { .container {
@include container; @include container;
margin-top: $page_top_offset; margin-top: $page_top_offset;
container: sizer / size;
@include tablet { @include tablet {
padding: 0 $gap; padding: 0 $gap;
@ -22,9 +36,37 @@ $cols: math.div($content_width, $cell);
} }
.grid { .grid {
grid-template-rows: 50vh; width: 100%;
min-height: 200px;
display: grid;
gap: #{$gap};
grid-template-columns: repeat(5, 1fr);
grid-auto-rows: calc((100cqw - 4 * #{$gap} / 2) / 5);
grid-template-rows: 40vh;
grid-auto-flow: row dense;
@include flow_grid; @include breakpoint(5);
@include breakpoint(4);
@include breakpoint(3) {
grid-template-rows: calc(66cqw - #{$gap}) auto;
}
@include breakpoint(2) {
grid-template-rows: calc(100cqw - #{$gap}) auto;
}
@container sizer (width < #{$flow_hide_recents}) {
.stamp {
grid-column-start: 1;
grid-row-end: span 1;
}
.login {
display: flex;
grid-column: 1 / 2;
grid-row-end: span 2;
}
}
} }
.pad_last { .pad_last {
@ -52,11 +94,6 @@ $cols: math.div($content_width, $cell);
justify-content: stretch; justify-content: stretch;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@media (max-width: $flow_hide_recents) {
grid-column-start: 1;
grid-row-end: span 1;
}
} }
.login { .login {
@ -72,10 +109,4 @@ $cols: math.div($content_width, $cell);
@include desktop { @include desktop {
display: none; display: none;
} }
@media (max-width: $flow_hide_recents) {
display: flex;
grid-column: 1 / 2;
grid-row-end: span 2;
}
} }

View file

@ -4,14 +4,19 @@
@import 'mixins'; @import 'mixins';
@import 'animations'; @import 'animations';
$gap: 8px;
$header_height: 64px; $header_height: 64px;
$cell: 250px; $cell: 250px;
$fluid_cell: $cell; // smaller cell for fluid flow $fluid_cell: $cell; // smaller cell for fluid flow
$cell_tablet: ($fluid_cell + 5) * 3 + 10; // flow breakpoint for tablet $cell_tablet: ($fluid_cell + 5) * 3 + 10; // flow breakpoint for tablet
$cell_mobile: ($fluid_cell + 5) * 2 + 10; // flow breakpoint for mobile $cell_mobile: ($fluid_cell + 5) * 2 + 10; // flow breakpoint for mobile
$flow_hide_recents: $cell_tablet; // breakpoint, there recents will be hidden
$gap: 10px; $target_flow_cell_width: 225px;
$flow_tablet_cell_count: 3;
$flow_hide_recents: $target_flow_cell_width * $flow_tablet_cell_count +
($flow_tablet_cell_count - 1) * $gap;
$lab_gap: $gap * 2; $lab_gap: $gap * 2;
$lab_gap_mobile: $gap * 2; $lab_gap_mobile: $gap * 2;
$grid_line: 5px; $grid_line: 5px;
@ -33,11 +38,16 @@ $panel_size: 64px;
$node_title_height: $panel_size; $node_title_height: $panel_size;
$upload_button_height: 52px; $upload_button_height: 52px;
$shadow_depth_1: transparentize(black, 0.8) 0 1px, inset $gray_90 0 1px; $shadow_depth_1:
$shadow_depth_2: transparentize(black, 0.8) 0 2px, inset $gray_90 0 1px; transparentize(black, 0.8) 0 1px,
inset $gray_90 0 1px;
$shadow_depth_2:
transparentize(black, 0.8) 0 2px,
inset $gray_90 0 1px;
$comment_shadow: $shadow_depth_2; $comment_shadow: $shadow_depth_2;
$node_shadow: transparentize(black, 0.8) 0 2px, $node_shadow:
transparentize(black, 0.8) 0 2px,
transparentize(black, 0.8) 0 2px 4px; transparentize(black, 0.8) 0 2px 4px;
$tag_height: 26px; $tag_height: 26px;