Update EmptyState macro to align with new designs

This commit is contained in:
leigh-mil 2019-12-03 15:03:14 -05:00
parent 74ff581570
commit 8e25adb1c3
5 changed files with 40 additions and 55 deletions

View File

@ -1,28 +1,20 @@
.empty-state { .empty-state {
padding: $gap * 3;
max-width: 100%;
background-color: $color-gray-lightest;
margin-top: $gap * 5;
hr {
margin-left: -$gap * 3;
margin-right: -$gap * 3;
}
&__footer {
text-align: center; text-align: center;
padding: 5rem ($gap * 2) 2rem;
display: flex;
flex-direction: column;
align-items: center;
max-width: 100%;
> .icon { a.usa-button {
@include icon-size(50); width: 60%;
@include icon-color($color-gray-light); display: inline-block;
}
&__message {
font-weight: $font-bold;
}
&__sub-message {
@include h4;
color: $color-gray;
max-width: 100%;
@include media($large-screen) {
@include h3;
} }
} }
} }

View File

@ -24,12 +24,11 @@
{% if not portfolio.applications %} {% if not portfolio.applications %}
{{ EmptyState( {{ EmptyState(
'This portfolio doesnt have any applications', header="You don't have any Applications yet",
action_label='Add a new application' if can_create_applications else None, message="You can manage multiple Applications within a single Portfolio as long as the funding sources are the same.",
action_href=url_for('applications.create_new_application_step_1', portfolio_id=portfolio.id) if can_create_applications else None, button_text="Create Your First Application",
icon='cloud', button_link=url_for("applications.view_new_application_step_1", portfolio_id=portfolio.id),
sub_message=None if can_create_applications else 'Please contact your JEDI Cloud portfolio administrator to set up a new application.', view_only_text="Contact your portfolio administrator to add an application."
add_perms=can_create_applications
) }} ) }}
{% else %} {% else %}

View File

@ -1,20 +1,14 @@
{% from "components/icon.html" import Icon %} {% macro EmptyState(header, message, button_text, button_link, view_only_text, user_can_create=True) %}
<div class="empty-state">
{% macro EmptyState(message, action_label, action_href, icon=None, sub_message=None, add_perms=True) -%} <h3>{{ header }}</h3>
<div class='empty-state'> <p>{{ message }}</p>
<p class='empty-state__message'>{{ message }}</p> <hr>
<div class="empty-state__footer">
{% if icon %} {% if user_can_create %}
{{ Icon(icon) }} <a href="{{ button_link }}" class="usa-button usa-button-primary">{{ button_text }}</a>
{% else %}
<p>{{ view_only_text }}</p>
{% endif %} {% endif %}
{% if sub_message %}
<p class='empty-state__sub-message'>{{ sub_message }}</p>
{% endif %}
{% if add_perms and (action_href and action_label) %}
<a href='{{ action_href }}' class='usa-button usa-button-big'>{{ action_label }}</a>
{% endif %}
</div> </div>
{%- endmacro %} </div>
{% endmacro %}

View File

@ -15,13 +15,13 @@
%} %}
{{ EmptyState( {{ EmptyState(
('portfolios.reports.empty_state.message' | translate), header='portfolios.reports.empty_state.message' | translate,
action_label= ('portfolios.reports.empty_state.action_label' | translate) if can_create_applications else None, message=message,
action_href=url_for('applications.create_new_application_step_1', portfolio_id=portfolio.id) if can_create_applications else None, button_text="Add a new application",
icon='chart', button_link=url_for("applications.view_new_application_step_1", portfolio_id=portfolio.id),
sub_message=message, view_only_text="Contact your portfolio administrator to create an application."
add_perms=can_create_applications
) }} ) }}
{% else %} {% else %}
<spend-table <spend-table
v-bind:applications='{{ monthly_totals['applications'] | tojson }}' v-bind:applications='{{ monthly_totals['applications'] | tojson }}'

View File

@ -107,11 +107,11 @@
{{ TaskOrderList(task_orders) }} {{ TaskOrderList(task_orders) }}
{% else %} {% else %}
{{ EmptyState( {{ EmptyState(
'This portfolio doesnt have any active or pending task orders.', header="Add approved task orders",
action_label='Add a New Task Order', message="Upload your approved Task Order here. You are required to confirm you have the appropriate signature. You will have the ability to add additional approved Task Orders with more funding to this Portfolio in the future.",
action_href=url_for('task_orders.form_step_one_add_pdf', portfolio_id=portfolio.id), button_link=url_for('task_orders.form_step_one_add_pdf', portfolio_id=portfolio.id),
icon='cloud', button_text="Add Task Order",
add_perms=user_can(permissions.CREATE_TASK_ORDER) view_only_text="Contact your portfolio administrator to add a Task Order."
) }} ) }}
{% endif %} {% endif %}
</div> </div>