Skip to content

Commit d1dee69

Browse files
Merge pull request #14 from hedgeye-sdeming/editing-updates
Editing updates
2 parents c26dd01 + 9d7219a commit d1dee69

File tree

11 files changed

+33
-7
lines changed

11 files changed

+33
-7
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ group :development do
99
gem "puma"
1010
gem "rspec"
1111
gem "rspec-rails"
12+
gem "ruby-lsp"
1213
gem "sprockets-rails"
1314

1415
# gem 'better_errors'

Gemfile.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ GEM
158158
rdoc (>= 4.0.0)
159159
reline (>= 0.4.2)
160160
json (2.7.2)
161+
language_server-protocol (3.17.0.3)
161162
logger (1.6.0)
162163
loofah (2.22.0)
163164
crass (~> 1.0.2)
@@ -210,6 +211,7 @@ GEM
210211
phlex-rails (1.2.1)
211212
phlex (~> 1.10.0)
212213
railties (>= 6.1, < 8)
214+
prism (1.0.0)
213215
protocol-hpack (1.5.0)
214216
protocol-http (0.33.0)
215217
protocol-http1 (0.22.0)
@@ -262,6 +264,8 @@ GEM
262264
zeitwerk (~> 2.6)
263265
rainbow (3.1.1)
264266
rake (13.2.1)
267+
rbs (3.5.3)
268+
logger
265269
rdoc (6.7.0)
266270
psych (>= 4.0.0)
267271
reline (0.5.9)
@@ -288,10 +292,16 @@ GEM
288292
rspec-mocks (~> 3.13)
289293
rspec-support (~> 3.13)
290294
rspec-support (3.13.1)
295+
ruby-lsp (0.17.17)
296+
language_server-protocol (~> 3.17.0)
297+
prism (~> 1.0)
298+
rbs (>= 3, < 4)
299+
sorbet-runtime (>= 0.5.10782)
291300
sawyer (0.9.2)
292301
addressable (>= 2.3.5)
293302
faraday (>= 0.17.3, < 3)
294303
securerandom (0.3.1)
304+
sorbet-runtime (0.5.11558)
295305
sprockets (4.2.1)
296306
concurrent-ruby (~> 1.0)
297307
rack (>= 2.2.4, < 4)
@@ -353,6 +363,7 @@ DEPENDENCIES
353363
puma
354364
rspec
355365
rspec-rails
366+
ruby-lsp
356367
sprockets-rails
357368
web-console
358369

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
//= link_tree ../fonts/phlex_storybook .ttf
12
//= link_tree ../../javascript/phlex_storybook .js
78.3 KB
Binary file not shown.

app/javascript/phlex_storybook/controllers/story_display_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default class extends Controller {
3737
value: this.getComponentSource(),
3838
language: "ruby",
3939
theme: "vs-dark",
40+
automaticLayout: true,
4041
});
4142
}
4243

config/routes.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
member do
77
get :preview
88
end
9+
10+
collection do
11+
# for monaco editor linked to experiments
12+
get 'codicon.ttf', to: redirect('/assets/phlex_storybook/codicon.ttf')
13+
end
914
end
1015

1116
resources :stories, only: [:index, :show, :update] do
1217
collection do
1318
get :all
1419

15-
get 'codicon.ttf', to: redirect(
16-
'https://cdn.jsdelivr.net/npm/monaco-editor@0.51.0/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf')
20+
# for monaco editor linked to components
21+
get 'codicon.ttf', to: redirect('/assets/phlex_storybook/codicon.ttf')
1722
end
1823
end
1924
end

lib/phlex_storybook/components/sidebar_menu.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def view_template
1313
turbo_frame_tag("sidebar_menu") do
1414
h2(class: "bg-slate-900 p-2") { "Components" }
1515
div(class: "px-2") do
16-
render_experiments
16+
render_experiments if PhlexStorybook.configuration.editable?
1717

1818
@story_components_by_category.each do |category, story_components|
1919
h4 { category }

lib/phlex_storybook/components/stories/component_display.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def view_template
3030

3131
div(class: "mb-4") { @story_component.description }
3232

33-
div(class: "container w-full h-fit min-w-0 mr-0") do
33+
div(class: "w-full h-fit min-w-0 mr-0") do
3434
render_story_header
3535
render ComponentRendering.new(
3636
story_component: @story_component,
@@ -47,7 +47,13 @@ def view_template
4747

4848
def blank_template
4949
render_header("Select a component")
50-
div(class: "px-2") { "Select a component or experiment from the left to see its details" }
50+
div(class: "px-2") do
51+
if PhlexStorybook.configuration.editable?
52+
"Select a component or experiment from the left to see its details"
53+
else
54+
"Select a component from the left to see its details"
55+
end
56+
end
5157
end
5258

5359
def render_header(text)

lib/phlex_storybook/layouts/application_layout.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def view_template(&)
2020
csp_meta_tag
2121
javascript_importmap_tags "phlex_storybook"
2222
stylesheet_link_tag "phlex_storybook_application", media: "all"
23+
# stylesheet_link_tag "https://cdn.jsdelivr.net/npm/vscode-codicons@0.0.17/dist/codicon.min.css", media: "all"
2324
turbo_refreshes_with method: :morph, scroll: :preserve
2425
end
2526

lib/phlex_storybook/tasks/install.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def install
2121
create_file("config/initializers/phlex_storybook.rb") do
2222
<<~RUBY
2323
# frozen_string_literal: true
24-
#
24+
2525
# Make sure to add the DSL and invoke ".storybook" in your components
2626
#
2727
# Example:

test/dummy/config/initializers/phlex_storybook.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
#
2+
33
# Make sure to add the DSL and invoke ".storybook" in your components
44
#
55
# Example:

0 commit comments

Comments
 (0)