Skip to content

Commit 8510329

Browse files
committed
styling/Make modals responsive
1 parent addc7ff commit 8510329

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

app/views/layouts/modal.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
From: "opacity-100 translate-y-0 sm:scale-100"
3434
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
3535
-->
36-
<div class="z-10 relative mt-2 inline-block align-bottom bg-white rounded-sm px-4 pt-5 pb-4 text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6" role="dialog" aria-modal="true" aria-labelledby="modal-headline" data-modal-target="body">
36+
<div class="z-10 relative mt-2 inline-block align-bottom bg-white rounded-sm px-4 pt-5 pb-4 text-left shadow-xl transform transition-all sm:my-8 sm:align-middle w-full sm:max-w-2xl sm:w-full sm:p-6" role="dialog" aria-modal="true" aria-labelledby="modal-headline" data-modal-target="body">
3737
<span data-action="click->modal#close" title="Close modal" class="hover:bg-cyan-hover transition cursor-pointer absolute z-12 -top-4 -right-5 inline-flex items-center p-1 border border-transparent rounded-full shadow-sm text-white bg-cyan mr-2">
3838
<%= render partial: 'shared/icons/close', locals: { height: 7, width: 7, color: 'text-white' } %>
3939
</span>

app/views/modals/snippets/edit.html.erb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@
1212
class="mt-4"
1313
>
1414
<%= form_for @snippet, remote: true, html: { data: { type: "html", action: "ajax:success->snippets#onUpdateSuccess ajax:error->snippets#onUpdateError" } } do |f| %>
15+
1516
<div>
16-
<%= f.text_field :description, { class: "new-snippet--description", placeholder: "Snippet title...", class: "block w-full mb-4 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-sm" } %>
17-
<%= f.text_area :body, { data: { codemirror_target: 'mirror' }, class: "font-mono h-80 block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-sm" } %>
17+
<%= f.text_field :description, { class: "new-snippet--description", placeholder: "Snippet title...", class: "block sm:w-full mb-4 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-sm" } %>
18+
<%= f.text_area :body, { data: { codemirror_target: 'mirror' }, class: "font-mono h-80 block sm:w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block sm:text-sm border-gray-300 rounded-sm" } %>
1819
</div>
1920

20-
<div class="flex mt-4">
21+
<div class="flex mt-4 flex-wrap">
2122
<div class="flex flex-1 items-center">
2223
<%= render partial: 'shared/form/toggle', locals: { form: f, field: :public, enabled_text: 'Private', disabled_text: 'Public', enabled: !@snippet.public, flip: true } %>
2324
</div>
2425

25-
<div class="flex flex-auto justify-end">
26-
<%= f.select :language_id, options_from_collection_for_select(@languages, :id, :name, @snippet.language_id), { prompt: 'Select language...' }, class: "block w-40 pl-3 pr-10 py-1 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-sm", data: { action: 'change->codemirror#updateMode' } %>
27-
<%= f.select :folder_id, options_from_collection_for_select(@folders, :id, :name, @folder.id), { prompt: 'Select folder...' }, { class: "ml-1 block w-40 pl-3 pr-10 py-1 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-sm" } %>
28-
<%= f.submit 'Update', class: "button--cta-primary ml-4" %>
26+
<div class="flex flex-auto justify-end mt-2 sm:mt-0">
27+
<div class="flex flex-wrap">
28+
<%= f.select :language_id, options_from_collection_for_select(@languages, :id, :name, @snippet.language_id), { prompt: 'Select language...' }, class: "mr-1 block w-40 pl-3 pr-10 py-1 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-sm", data: { action: 'change->codemirror#updateMode' } %>
29+
<%= f.select :folder_id, options_from_collection_for_select(@folders, :id, :name, @folder.id), { prompt: 'Select folder...' }, { class: "mt-1 sm:mt-0 block w-40 pl-3 pr-10 py-1 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-sm" } %>
30+
</div>
31+
<div class="flex items-end">
32+
<%= f.submit 'Update', class: "button--cta-primary ml-4" %>
33+
</div>
2934
</div>
3035
</div>
3136
<% end %>

0 commit comments

Comments
 (0)