-
Notifications
You must be signed in to change notification settings - Fork 2
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
[DSS-328] Upload Card - Layout Update #1782
Merged
+455
−158
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c04f9c2
fix(upload card): align specs, refactor template logic
teenwolfblitzer fef2c66
refactor(upload card): restructure card
teenwolfblitzer 56b9279
chore(upload card): remove container assignment
teenwolfblitzer f2536ca
feat(upload card): force stack layout option
teenwolfblitzer 28078c4
fix(upload card): examples, file types and a11y fixes
teenwolfblitzer 760215d
chore(upload card): remove container experiment
teenwolfblitzer 23efd64
fix(upload card): remove input and label with custom actions
teenwolfblitzer 91c7fa8
feat(upload card): adjust content areas
teenwolfblitzer fde0ba7
fix(upload card): style adjustments
teenwolfblitzer fdaff51
docs(upload card): update rails examples
teenwolfblitzer 8dbdb8b
fix(upload card): fixes issue with content for content is replicated …
anechol 598e4d0
style(upload card): updates instructions font style and stack spacing
anechol 92270c7
refactor(upload card): refactors logic for React to match Rails version
anechol 4ccb1ca
feat(upload card): adds stacked layout and id props
anechol 4d0e099
docs(upload card): adds stack example to storybook
anechol b534bfc
test(upload card): adds tests for upload card
anechol df6c048
docs(upload card): adds descriptions to stories and fixes preview ima…
anechol 59c1515
docs(upload card): adds missing button to Rails preview
anechol 77de1bf
docs: updates variable name for consistency
anechol ad36f96
refactor(upload card): refactors label and button logic
anechol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
111 changes: 89 additions & 22 deletions
111
docs/app/views/examples/components/upload_card/_preview.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,109 @@ | ||
<h3 class="t-sage-heading-6">Initial State</h3> | ||
<% | ||
dropdown_menu_items = [ | ||
{ | ||
value: "Upload file", | ||
}, { | ||
value: "Select recent file", | ||
}, { | ||
style: "danger", | ||
modifiers: ["border-before"], | ||
value: "Remove image", | ||
} | ||
] | ||
%> | ||
|
||
<h3>Default State (no file selected)</h3> | ||
|
||
<%= sage_component SageUploadCard, { | ||
selection_label: "Select a file", | ||
selection_subtext: "Recommended dimensions or file size requirements", | ||
} %> | ||
id: "upload-card-default", | ||
selection_label: "Select file", | ||
} do %> | ||
<% content_for :sage_upload_card_instructions do %> | ||
<p>Upload a JPEG</p> | ||
<% end %> | ||
<% end %> | ||
|
||
<h3>Selected File State</h3> | ||
|
||
<h3 class="t-sage-heading-6">Selected File State</h3> | ||
<p>Restrict accepted file types using <code>accepted_file_types</code>.</p> | ||
|
||
<%= sage_component SageUploadCard, { | ||
accepted_files: [ | ||
{name: "contacts.csv"}, | ||
{name: "my-image-file.jpg"}, | ||
], | ||
file_selected: true, | ||
accepted_file_types: ["image/jpg"], | ||
selection_preview: "https://placekitten.com/360", | ||
selection_label: "Replace file", | ||
selection_subtext: "Recommended dimensions or file size requirements", | ||
} %> | ||
id: "upload-card-selected", | ||
} do %> | ||
<% content_for :sage_upload_card_instructions do %> | ||
<p>Upload a JPEG this is a test</p> | ||
<% end %> | ||
<% end %> | ||
|
||
<h3 class="t-sage-heading-6">Error State</h3> | ||
|
||
<h3>Vertical (stacked) layout</h3> | ||
<p>The default layout will adjust from a vertical (stacked) orientation to horizontal depending on available space and/or screen size.</p> | ||
|
||
<p>Setting <code>stack_layout</code> to <code>true</code> locks the component to the vertical orientation.</p> | ||
|
||
<%= sage_component SageUploadCard, { | ||
has_error: true, | ||
selection_label: "Select a file", | ||
selection_subtext: "Recommended dimensions or file size requirements", | ||
errors: [ | ||
{text: "This is the error message."}, | ||
] | ||
} %> | ||
accepted_files: [ | ||
{name: "my-image-file.jpg"}, | ||
], | ||
file_selected: true, | ||
selection_preview: "https://placekitten.com/360", | ||
stack_layout: true, | ||
id: "upload-card-stack", | ||
selection_label: "Edit file", | ||
} do %> | ||
<% content_for :sage_upload_card_instructions do %> | ||
<p>Recommended dimensions or file size requirements</p> | ||
<% end %> | ||
<% end %> | ||
|
||
<h3 class="t-sage-heading-6">Selected Error State</h3> | ||
<h3>Custom content areas</h3> | ||
<h4>Instructions area</h4> | ||
<p>The <code>sage_upload_card_instructions</code> slot provides an area for extended instructions and custom markup.</p> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: extra space between 'for extended' |
||
<h4>Actions area</h4> | ||
<p>Use the <code>sage_upload_card_actions</code> slot to replace the default button and display custom components, such as dropdowns.</p> | ||
<p><strong>NOTE:</strong> a file input field and label are <em>included by default in the base component</em>, as seen in the examples above. When applying a custom file input with `sage_upload_card_actions`, set <code>custom_file_input_field</code> to <code>true</code> to remove these defaults.</p> | ||
<%= sage_component SageUploadCard, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the sage_upload_card_actions be wrapped in |
||
accepted_files: [ | ||
{name: "contacts.csv"}, | ||
{name: "fluffy-kitteh.jpg"}, | ||
], | ||
custom_file_input_field: true, | ||
file_selected: true, | ||
selection_preview: "https://placekitten.com/360", | ||
id: "upload-card-dropdown" | ||
} do %> | ||
<% content_for :sage_upload_card_actions do %> | ||
<%= sage_component SageDropdown, { items: dropdown_menu_items } do %> | ||
<% content_for :sage_dropdown_trigger, flush: true do %> | ||
<%= sage_component SageButton, { | ||
style: "secondary", | ||
icon: { name: "caret-down", style: "right" }, | ||
value: "Edit file", | ||
} %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
|
||
<h3>Error State</h3> | ||
|
||
<%= sage_component SageUploadCard, { | ||
has_error: true, | ||
selection_label: "Replace file", | ||
selection_subtext: "Recommended dimensions or file size requirements", | ||
id: "upload-card-error", | ||
selection_label: "Select a file", | ||
errors: [ | ||
{text: "This is the error message."}, | ||
{text: "This is an error message."}, | ||
] | ||
} %> | ||
} do %> | ||
<% content_for :sage_upload_card_instructions do %> | ||
<p>Recommended dimensions or file size requirements</p> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 45 additions & 31 deletions
76
docs/lib/sage_rails/app/views/sage_components/_sage_upload_card.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐈