Skip to content

Commit 16364ae

Browse files
authored
Add scrolling to example config, dynamic scrolling setting on iframe (#10)
1 parent 9f2a1be commit 16364ae

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/surface/catalogue/live/page_live.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ defmodule Surface.Catalogue.PageLive do
133133
<div :show={{ @action == "example" }} class="Example {{example.direction}}">
134134
<div class="demo" style="width: {{example.demo_perc}}%">
135135
<iframe
136-
scrolling="no"
136+
scrolling={{ if example.scrolling, do: "yes", else: "no"}}
137137
id="example-iframe-{{index}}"
138138
src={{ path_to(@socket, ExampleLive, example.module_name, __window_id__: @__window_id__) }}
139139
style="overflow-y: hidden; width: 100%; height: {{ example.height }};"

lib/surface/catalogue/util.ex

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ defmodule Surface.Catalogue.Util do
2828
title = Keyword.get(config, :title)
2929
direction = Keyword.get(config, :direction) || "horizontal"
3030
height = Keyword.get(config, :height) || "120px"
31+
scrolling = Keyword.get(config, :scrolling) || false
3132

3233
{demo_perc, code_perc} =
3334
case {direction, Keyword.get(config, :code_perc)} do
@@ -49,7 +50,8 @@ defmodule Surface.Catalogue.Util do
4950
code: code,
5051
direction: direction,
5152
demo_perc: demo_perc,
52-
code_perc: code_perc
53+
code_perc: code_perc,
54+
scrolling: scrolling
5355
}
5456
end
5557
|> Enum.sort_by(& &1.module_name)

0 commit comments

Comments
 (0)