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

MWPW-157037: Nonprofit handover #832

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions acrobat/blocks/nonprofit/icons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions acrobat/blocks/nonprofit/icons/back.svg

This file was deleted.

3 changes: 0 additions & 3 deletions acrobat/blocks/nonprofit/icons/chevron-right.svg

This file was deleted.

3 changes: 0 additions & 3 deletions acrobat/blocks/nonprofit/icons/close.svg

This file was deleted.

1 change: 0 additions & 1 deletion acrobat/blocks/nonprofit/icons/upload.svg

This file was deleted.

18 changes: 11 additions & 7 deletions acrobat/blocks/nonprofit/nonprofit-select.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable chai-friendly/no-unused-expressions */
/* eslint-disable max-len */
import ReactiveStore from '../../scripts/reactiveStore.js';

const chevronDownSvg = '<svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.64477 6.53455L11.3367 1.84314C11.6931 1.48767 11.6931 0.910519 11.3367 0.554079C10.9807 0.198119 10.4036 0.198119 10.0476 0.554079L6.00025 4.60102L1.95289 0.554079C1.59693 0.198119 1.01978 0.198119 0.663827 0.554079C0.485607 0.732299 0.396736 0.965209 0.396736 1.19861C0.396736 1.43201 0.486097 1.66541 0.663827 1.84314L5.35572 6.53455C5.5337 6.71277 5.76697 6.80164 6.00025 6.80152C6.23353 6.80164 6.46679 6.71277 6.64477 6.53455Z" fill="#222222"/></svg>';
import { getNonprofitIconTag, NONPRFIT_ICONS } from './icons.js';

export default function nonprofitSelect(props) {
const {
Expand Down Expand Up @@ -37,6 +36,7 @@ export default function nonprofitSelect(props) {
class: 'np-input np-select-search',
type: 'text',
placeholder,
'data-for': name,
});
const valueTag = createTag('input', {
class: `np-select-value${required ? ' np-required-field' : ''}`,
Expand All @@ -54,7 +54,7 @@ export default function nonprofitSelect(props) {
}

const listContainerTag = createTag('div', { class: 'np-select-list-container' });
const listTag = createTag('ul', { class: 'np-select-list' });
const listTag = createTag('ul', { class: 'np-select-list', 'data-for': name });

let searchTimeout;
let abortController;
Expand Down Expand Up @@ -208,12 +208,18 @@ export default function nonprofitSelect(props) {
listTag.append(itemTag);
});

const infoTagKeydown = () => {
focusedFromList = true;
searchTag.focus();
};

if (!loading && storeOptions.length === 0) {
const noOptionsTag = createTag(
'div',
{ class: 'np-select-list-tag np-select-no-options', tabindex: -1 },
noOptionsText,
);
noOptionsTag.addEventListener('keydown', infoTagKeydown);
noOptionsTag.addEventListener('focusout', focusOut);
listTag.append(noOptionsTag);
}
Expand All @@ -224,6 +230,7 @@ export default function nonprofitSelect(props) {
{ class: 'np-select-list-tag np-select-loader', tabindex: -1 },
`${loadingText}...`,
);
loadingTag.addEventListener('keydown', infoTagKeydown);
loadingTag.addEventListener('focusout', focusOut);
listTag.append(loadingTag);
}
Expand All @@ -245,10 +252,7 @@ export default function nonprofitSelect(props) {
controlTag.append(labelTag, searchTag, valueTag, listContainerTag);

if (!hideIcon) {
const arrowIconTag = createTag('div', { class: 'np-select-icon' }, chevronDownSvg);
arrowIconTag.addEventListener('click', () => {
searchTag.focus();
});
const arrowIconTag = getNonprofitIconTag(NONPRFIT_ICONS.CHEVRON_DOWN);
controlTag.append(arrowIconTag);
}

Expand Down
149 changes: 73 additions & 76 deletions acrobat/blocks/nonprofit/nonprofit.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
box-sizing: border-box;
}

.np-icon path {
fill: var(--color-gray-600);
}

.np-stepper-container {
display: flex;
align-items: center;
Expand Down Expand Up @@ -78,8 +82,10 @@
.np-step-separator {
width: 12px;
height: 12px;
background: url(./icons/chevron-right.svg) no-repeat;
background-position: top 2px left 3px;
}

.np-step-separator.np-icon path {
fill: none;
}

.np-stepper-back {
Expand All @@ -98,10 +104,20 @@
transition: left 200ms;
}

.np-stepper-back:hover {
.np-stepper-back:hover,
.np-stepper-back:focus {
background-color: var(--color-gray-300);
}

.np-stepper-back:hover .np-icon path,
.np-stepper-back:focus .np-icon path {
fill: var(--color-gray-800);
}

.np-stepper-back.disabled {
background-color: var(--color-gray-100);
}

.np-content-container {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -136,6 +152,24 @@
gap: 25px;
}

.np-button {
background-color: var(--link-color);
color: var(--color-white);
font-weight: 700;
font-size: 16px;
line-height: 20px;
border: none;
border-radius: 20px;
padding: 10px 20px;
cursor: pointer;
}

.np-button:disabled {
background-color: var(--np-button-disabled-background);
color: var(--np-button-disabled-color);
cursor: default;
}

.np-form .np-button {
align-self: start;
}
Expand Down Expand Up @@ -172,33 +206,23 @@
color: var(--np-input-placeholder-color);
}

.np-input[type='file'] {
color: transparent;
user-select: none;
position: relative;
background: url(./icons/upload.svg) no-repeat;
background-size: 20px;
background-position: right 10px bottom 10px;
.np-control .np-icon {
position: absolute;
height: 12px;
right: 15px;
top: 39px;
display: flex;
cursor: pointer;
pointer-events: none;
}

.np-input[type='file']:valid {
color: inherit;
}

.np-input[type='file']:valid::after {
display: none;
}

.np-input[type='file']::after {
content: attr(data-placeholder);
position: absolute;
left: 15px;
color: var(--np-input-placeholder-color);
.np-input:disabled ~ .np-icon path,
.np-stepper-back.disabled .np-icon path {
fill: var(--color-gray-400);
}

.np-input[type='file']::file-selector-button {
display: none;
.np-input[type='file'] ~ .np-input {
cursor: pointer;
}

.np-select-search {
Expand All @@ -208,19 +232,6 @@
white-space: nowrap;
}

.np-select-icon {
position: absolute;
padding: 6px;
right: 6px;
top: 36px;
display: flex;
cursor: pointer;
}

.np-input:disabled ~ .np-select-icon path {
fill: var(--color-gray-400);
}

.np-select-list-container {
display: none;
position: absolute;
Expand Down Expand Up @@ -352,63 +363,49 @@
background-color: var(--np-selected-organization-fallback-background);
}

.np-selected-organization-avatar.fallback .np-selected-organization-logo {
display: none;
.np-selected-organization-logo {
object-fit: contain;
}

.np-selected-organization-avatar:not(.fallback) .np-selected-organization-initials {
.np-selected-organization-avatar.fallback .np-selected-organization-logo {
display: none;
}

.np-selected-organization-logo {
object-fit: contain;
}

.np-selected-organization-initials {
color: var(--color-white);
font-size: 18px;
font-weight: 700;
}

.np-selected-organization-avatar:not(.fallback) .np-selected-organization-initials {
display: none;
}

.np-selected-organization-separator {
height: 1px;
background-color: var(--color-gray-300);
}

.np-selected-organization-clear {
position: absolute;
width: 12px;
height: 12px;
display: flex;
top: 15px;
right: 15px;
cursor: pointer;
}

.np-selected-organization-clear:hover .np-icon path,
.np-selected-organization-clear:focus .np-icon path {
fill: var(--color-gray-800);
}

.np-personal-data-disclaimer {
font-size: 14px;
line-height: 18px;
padding-bottom: 15px;
color: var(--color-gray-600);
}

.np-button {
background-color: var(--link-color);
color: var(--color-white);
font-weight: 700;
font-size: 16px;
line-height: 20px;
border: none;
border-radius: 20px;
padding: 10px 20px;
cursor: pointer;
}

.np-button:disabled {
background-color: var(--np-button-disabled-background);
color: var(--np-button-disabled-color);
cursor: default;
}

.np-application-review-container {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -447,7 +444,7 @@
}
}

/* Temporary stuff */
/* Temporary stuff below (TODO - remove) */
.nonprofit {
display: flex;
flex-direction: column;
Expand All @@ -468,16 +465,7 @@
.np-controller-title {
font-weight: 700;
font-size: 16px;
color: var(--feds-color-adobeBrand);
}

.np-controller-section {
display: flex;
width: 415px;

& .np-controller-button:last-child {
margin: 0;
}
color: var(--link-color);
}

.np-controller-button {
Expand Down Expand Up @@ -505,3 +493,12 @@
color: var(--color-white);
}
}

.np-controller-section {
display: flex;
width: 415px;

& .np-controller-button:last-child {
margin: 0;
}
}
Loading
Loading