Skip to content

Commit

Permalink
improve(ui): details for block container
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 committed Nov 25, 2022
1 parent 7c0d3cb commit 748fa46
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
33 changes: 16 additions & 17 deletions src/main/frontend/components/block.cljs
Expand Up @@ -1677,23 +1677,22 @@
(when (and (coll? children)
(seq children)
(not collapsed?))
(let [doc-mode? (state/sub :document/mode?)]
[:div.block-children-container.flex {:style {:margin-left (if doc-mode? 18 29)}}
[:div.block-children-left-border
{:on-click (fn [_]
(editor-handler/toggle-open-block-children! (:block/uuid block)))}]
[:div.block-children.w-full {:style {:display (if collapsed? "none" "")}}
(for [child children]
(when (map? child)
(let [child (dissoc child :block/meta)
config (cond->
(-> config
(assoc :block/uuid (:block/uuid child))
(dissoc :breadcrumb-show? :embed-parent))
(or ref? query?)
(assoc :ref-query-child? true))]
(rum/with-key (block-container config child)
(:block/uuid child)))))]]))))
[:div.block-children-container.flex
[:div.block-children-left-border
{:on-click (fn [_]
(editor-handler/toggle-open-block-children! (:block/uuid block)))}]
[:div.block-children.w-full {:style {:display (if collapsed? "none" "")}}
(for [child children]
(when (map? child)
(let [child (dissoc child :block/meta)
config (cond->
(-> config
(assoc :block/uuid (:block/uuid child))
(dissoc :breadcrumb-show? :embed-parent))
(or ref? query?)
(assoc :ref-query-child? true))]
(rum/with-key (block-container config child)
(:block/uuid child)))))]])))

(defn- block-content-empty?
[{:block/keys [properties title body]}]
Expand Down
9 changes: 6 additions & 3 deletions src/main/frontend/components/block.css
Expand Up @@ -137,6 +137,7 @@

.block-children-container {
position: relative;
margin-left: 29px;
}

.block-children-left-border {
Expand Down Expand Up @@ -323,8 +324,6 @@
}

.ls-block {
@apply border border-dashed border-green-600;

position: relative;
min-height: 24px;
padding: 2px 0;
Expand Down Expand Up @@ -517,7 +516,7 @@ a:hover > .bullet-container {
background-color: var(--ls-block-bullet-border-color, #ced9e0);
}

.doc-mode {
.content.doc-mode {
margin-left: -16px;

.block-children-left-border {
Expand All @@ -527,6 +526,10 @@ a:hover > .bullet-container {
.hide-inner-bullet .bullet {
display: none;
}

.block-children-container {
margin-left: 18px;
}
}

/* copied from https://github.com/drdogbot7/tailwindcss-responsive-embed */
Expand Down
8 changes: 8 additions & 0 deletions src/main/frontend/components/theme.css
Expand Up @@ -151,4 +151,12 @@ main.ls-fold-button-on-right {
width: 100%;
}
}

.block-children-container {
margin-left: 7px;

.block-children {
padding-left: 10px;
}
}
}

0 comments on commit 748fa46

Please sign in to comment.