Skip to content
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

docs(file-uploader): show legacy file uploader in vanilla docs #5265

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,22 @@ module.exports = {
exampleUploadStates: true,
},
},
{
name: 'legacy',
label: 'Legacy file uploader',
context: {
id: 'legacy-file-uploader',
legacy: true,
},
},
{
name: 'legacy with example upload states',
label: 'Legacy file uploader with example upload states',
context: {
id: 'legacy-file-uploader-states',
legacy: true,
exampleUploadStates: true,
},
},
],
};
51 changes: 51 additions & 0 deletions packages/components/src/components/file-uploader/file-uploader.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
LICENSE file in the root directory of this source tree.
-->

{{#unless legacy}}
<div class="{{prefix}}--form-item">
<strong class="{{prefix}}--file--label">Account
photo</strong>
Expand Down Expand Up @@ -57,3 +58,53 @@
</div>
</div>
</div>
{{else}}
<div class="{{prefix}}--form-item">
<strong class="{{prefix}}--file--label">Account
photo</strong>
<p class="{{prefix}}--label-description">Only .jpg and .png files. 500kb max file size.</p>
<div class="{{prefix}}--file" data-file data-file-demo-state-manager>
<label for="legacy-file-uploader" class="{{prefix}}--file-btn {{prefix}}--btn {{prefix}}--btn--primary"
role="button" tabindex="0">Add file</label>
<input type="file" class="{{prefix}}--file-input" id="legacy-file-uploader" data-file-uploader
data-target="[data-file-container]" multiple />
<div data-file-container data-file-drop-container class="{{prefix}}--file-container">
{{#if exampleUploadStates}}
<div class="{{prefix}}--file__selected-file">
<p class="{{prefix}}--file-filename">Lorem ipsum dolor sit amet consectetur adipisicing elit. Libero vero
sapiente illum reprehenderit molestiae perferendis voluptatem temporibus laudantium ducimus magni voluptatum
veniam, odit nesciunt corporis numquam maxime sunt excepturi sint!</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
{{ carbon-icon 'CheckmarkFilled16' class=(add prefix '--file-complete') }}
</span>
</div>
<div class="{{prefix}}--file__selected-file {{prefix}}--file__selected-file--invalid" data-invalid>
<p class="{{prefix}}--file-filename">color.jpeg</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
{{ carbon-icon 'WarningFilled16' class=(add prefix '--file--invalid')}}
{{ carbon-icon 'Close16' class=(add prefix '--file-close') aria-label="Remove uploaded file" tabindex="0" }}
</span>
<div class="{{prefix}}--form-requirement">
<div class="{{prefix}}--form-requirement__title">File size exceeds limit.</div>
<p class="{{prefix}}--form-requirement__supplement">500 kb max file size. Select a new file and try
again.</p>
</div>
</div>
<div class="{{prefix}}--file__selected-file">
<p class="{{prefix}}--file-filename">color.jpeg</p>
<span data-for="{{id}}" class="{{prefix}}--file__state-container">
<div class="{{prefix}}--inline-loading__animation">
<div data-inline-loading-spinner="" class="{{prefix}}--loading {{prefix}}--loading--small">
<svg class="{{prefix}}--loading__svg" viewBox="-75 -75 150 150">
<circle class="{{prefix}}--loading__background" cx="0" cy="0" r="26.8125"></circle>
<circle class="{{prefix}}--loading__stroke" cx="0" cy="0" r="26.8125"></circle>
</svg>
</div>
</div>
</span>
</div>
{{/if}}
</div>
</div>
</div>
{{/unless}}