mattjennings / mdsvexamples

Render your Svelte code blocks in MDSveX
35 stars 3 forks source link

How to make it width 100% #10

Closed shinokada closed 2 years ago

shinokada commented 2 years ago

I added width 100% but the code and example blocks are about 500px. How can I make it 100%?

You can see the size difference in the following image.

image

mattjennings commented 2 years ago

Does this happen with the default Example component? I don't think there's anything that should be enforcing 500px width

shinokada commented 2 years ago

It seems that the box width depends what you have. The following is using the default Example.

image

shinokada commented 2 years ago

The solution for me was to add a div around.

But if I add the div in the Example.svelte, it doesn't work.

image

image

shinokada commented 2 years ago

It seems that I need to import a component in the each svelte example block. Is there any way that I import once at the top and no need to write it in the svelte example block?

For example:

<script>
import {Button} from 'mylib'
</script>

```svelte example
<Button />
mattjennings commented 2 years ago

Not at the moment, it's something I might look into but haven't yet.

Closing this as the topic issue has been solved.