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

Add indentation support for components #1015

Closed
damithc opened this issue Feb 3, 2020 · 7 comments · Fixed by #1719
Closed

Add indentation support for components #1015

damithc opened this issue Feb 3, 2020 · 7 comments · Fixed by #1719

Comments

@damithc
Copy link
Contributor

damithc commented Feb 3, 2020

When using MarkBind, I find myself needing to indent panels/boxes to match the surrounding contents.
image

Normally I do that by wrapping a <div> around the component but it does add noise to the code somewhat. I'm wondering if we can provide a attribute such as indent="20" to indicate the indentation level for the whole component.

I'm not sure if the same can be achieved using the current add-class mechanism; it cannot be used to indent the whole component, right?

ADD: Another place where this feature can be useful is <include>

@damithc damithc added p.Low a-AuthorUsability c.Feature 🚀 s.UnderDiscussion The team will evaluate this issue to decide whether it is worth adding labels Feb 3, 2020
@acjh
Copy link
Contributor

acjh commented Feb 4, 2020

Yes, the same can be achieved using add-class for <box> and <panel> etc.

Since <include> does not wrap the contents, it cannot. Instead, do it in the included file.

@damithc
Copy link
Contributor Author

damithc commented Feb 5, 2020

My code:

<box>

Some text
</box>

<div class="indented-level2">
<box>

Some text
</box>
</div>

<box add-class="indented-level2">

Some text
</box>
.indented-level2 {
    padding-left: 40px;
}

Output:
image

What I want to achieve is the middle one. add-class applies the indentation to the box content, not the box itself. Should I use a different css code?

@acjh
Copy link
Contributor

acjh commented Feb 5, 2020

Yes, use margin-left CSS property instead of padding-left .

From https://developer.mozilla.org/en-US/docs/Web/CSS/padding:

Note: Padding creates extra space within an element. In contrast, margin creates extra space around an element.

@damithc
Copy link
Contributor Author

damithc commented Feb 6, 2020

Yes, use margin-left CSS property instead of padding-left .

Nice 👍
In fact, we can use bootstrap built-in util classes instead of writing our own (e.g., box add-clas="ml-2">, as long as the indentation we want is not too deep.

Let's leave this issue open until we document this as a tip/trick somewhere in the user guide.

@damithc damithc added a-Documentation 📝 and removed s.UnderDiscussion The team will evaluate this issue to decide whether it is worth adding labels Feb 6, 2020
@damithc
Copy link
Contributor Author

damithc commented Feb 10, 2020

Yes, use margin-left CSS property instead of padding-left .

Works for boxes but not for panels 🤔 perhaps panels override the margin properties?

@acjh
Copy link
Contributor

acjh commented Feb 10, 2020

You need to add d-block class too, as panel's card-container is an inline <span>.

@damithc
Copy link
Contributor Author

damithc commented Feb 10, 2020

You need to add d-block class too, as panel's card-container is an inline <span>.

Got it. Thx 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants