Commit 7b237c7e authored by git's avatar git Committed by Iris Ibekwe
Browse files

Issue #3039824 by fskreuz, Irisibk: USWDS 2.0

parent b970ea47
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
_notes*
# Dependencies
node_modules/
vendor/

# Generated files and directories
assets/*

# Log files
*.log

# Hidden files and directories
.*
!.gitignore

# Lock files
~*
+18 −12
Original line number Diff line number Diff line
@@ -7,6 +7,12 @@
 * Sass development.
 */

/* Flex the region div that goes between usa-navbar and usa-logo */
.region-header {
  /* TODO: This is MOBILE ONLY */
  flex: 1 0 0;
}

/* The navigation z-index of 9000 causes issues (like with admin_menu). */
.usa-nav {
  z-index: 500;
@@ -21,10 +27,10 @@
}

/* A little help for breadcrumbs. */
.usa-breadcrumbs li:not(:last-child):after {
.uswds-breadcrumbs li:not(:last-child):after {
  content: '»';
}
.usa-breadcrumbs li, .usa-breadcrumbs li a {
.uswds-breadcrumbs li, .usa-breadcrumbs li a {
  margin-right: 0.4em;
}

@@ -38,10 +44,6 @@
.uswds-main-content-wrapper {
  margin-top: 1em;
}
.uswds-middle-section {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* Vertical tab help */
.js-form-type-vertical-tabs {
@@ -69,7 +71,7 @@ label.visually-hidden + input[type=checkbox] {
}

/* Styling for our custom non-collapsible accordions. */
.uswds-uncollapsible-title + .usa-accordion-content {
.uswds-uncollapsible-title + .usa-accordion__content {
  position: static;
}
.uswds-uncollapsible-title {
@@ -92,11 +94,6 @@ label.visually-hidden + input[type=checkbox] {
  box-sizing: content-box;
}

/* Help for search block. */
.search-block-form {
  display: inline-block;
}

/* Some help for pagers. */
.pager .pager__items {
  list-style-type: none;
@@ -155,3 +152,12 @@ label.visually-hidden + input[type=checkbox] {
.comment--unpublished {
  background-color: #fff4f4;
}

/**
 * Because uswds subclasses classy, Drupal loads hidden.module.css. It comes
 * with .hidden which, as you expect, does display: none. We don't want that as
 * .usa-footer-collapsible.hidden isn't for hiding. It's the collapsible state.
 */
.usa-footer-collapsible.hidden {
  display: block;
}
+4 −4
Original line number Diff line number Diff line
@@ -5,9 +5,9 @@
 * Alterations for ALL forms.
 */

use \Drupal\Core\Form\FormStateInterface;
use \Drupal\Core\Entity\EntityFormInterface;
use \Drupal\webform\WebformSubmissionForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityFormInterface;
use Drupal\webform\WebformSubmissionForm;

/**
 * Implements hook_form_alter().
@@ -26,6 +26,6 @@ function uswds_form_alter(&$form, FormStateInterface $form_state, $form_id) {
      }
    }

    $form['#attributes']['class'][] = 'usa-form-large';
    $form['#attributes']['class'][] = 'usa-form';
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -13,5 +13,5 @@ use Drupal\Core\Form\FormStateInterface;
function uswds_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // Make the delete button on node forms pop.
  $form['actions']['delete']['#attributes']['class'][] = 'usa-button';
  $form['actions']['delete']['#attributes']['class'][] = 'usa-button-secondary';
  $form['actions']['delete']['#attributes']['class'][] = 'usa-button--secondary';
}
+0 −24
Original line number Diff line number Diff line
@@ -18,28 +18,4 @@ function uswds_form_user_login_form_alter(&$form, FormStateInterface $form_state

  // Allow logging in with username OR email.
  $form['name']['#title'] = t('Username or email address');
  $form['name']['#element_validate'][] = '_uswds_user_login_validate';
}

/**
 * Callback to validate the user login form.
 *
 * Credit for this code/approach goes to login_emailusername module.
 */
function _uswds_user_login_validate($element, FormStateInterface &$form_state) {
  $name_input = $form_state->getValue('name');

  // Try loading by email.
  if ($user = user_load_by_mail($name_input)) {
    // Set the username for further validation.
    $form_state->setValue('name', $user->getUsername());
    return TRUE;
  }

  // Try loading by username.
  if ($user = user_load_by_name($name_input)) {
    return TRUE;
  }

  return FALSE;
}
Loading