diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..686c443 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# Drupal editor configuration normalization +# @see http://editorconfig.org/ + +# This is the top-most .editorconfig file; do not search in parent directories. +root = true + +# All files. +[*] +end_of_line = LF +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[composer.{json,lock}] +indent_size = 4 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0161920 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/starter_theme/" # Location of package manifests + schedule: + interval: "weekly" + labels: + - "npm" + - "dependencies" + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..8619c0c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,68 @@ + + + + +## Related issue + +Closes #_[issue_no]_ + + +## Summary + +Insert a brief summary of the changes included in this PR and any additional information or context which may help the reviewer. + +## Breaking change + +Indicate if this update includes a breaking change by selecting an option below: +- [ ] This IS NOT a breaking change. +- [ ] :warning: This IS a breaking change. + + +## Testing and review + +### Setup + +1. Insert any required steps to take before beginning test. + +### QA/Test + +1. Insert steps to test and confirm the result resolves the issue. + +## Checklist for the Developer + +- [ ] A link to the issue has been included above. +- [ ] No merge conflicts exist with the target branch. +- [ ] Automated tests have passed on this PR. +- [ ] Deployment and testing steps have been documented above, if applicable. + +## Checklist for the Reviewers + +- [ ] The file changes are relevant to the task objective and resolve the issue. +- [ ] Code standards and best practices are followed. +- [ ] QA/Test steps were successfully completed. +- [ ] Applicable logs are free of errors. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7c1df8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Ignore files generated by common IDEs. +.idea +.vscode + +# Ignore OS generated files. +.DS_Store* +ehthumbs.db +Thumbs.db +._* \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..12244fc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contribution Guide for Bixal USWDS Drupal Theme + +## 1. Set up your local development environment +1. Create a forked repository from the bixaluswds repo. See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo for instructions on how to fork the repository. +2. Complete the Drupal standard installation following the instructions outlined here: https://github.com/rayestrada/drupalstandard. + +## 2. Generate child theme, install and set as default + +### Initialize child theme using drupal theme generate function +Determine what theme machine name you want to use in this example we are using `my_new_theme`. +First create a `custom` directory in `themes` directory if there isn't one: `mkdir web/themes/custom`. +``` +lando php web/core/scripts/drupal generate-theme --starterkit starter_theme my_new_theme --path themes/custom +lando drush cr +``` + +### Remove these lines from your custom theme .info.yml file +``` +hidden: true +starterkit: true +``` + +### Install and set your custom theme as the default +In this example the theme machine name is `my_new_theme`. +The theme dependencies are already met in the Drupal standard installation. +``` +lando drush theme:install my_new_theme +``` + + +## 3. Work on an issue +### Create a feature branch off `dev` for development +Navigate into the base theme directory +``` +cd web/themes/custom/bixaluswds` +``` +Checkout the `dev` branch and pull changes +``` +git checkout dev +git pull origin +``` +Create a new feature branch +``` +git checkout -b issue/#-short-descriptive-label +``` + +### Create a pull request +Commit your file modifications and push into your fork +``` +git push fork branch-name +``` +Visit https://github.com/Bixal/bixaluswds/compare and create a pull request from your fork branch (source) to `Bixal:dev` (target). +Follow the PR template instructions to complete the PR. Then update the GitHub issue with a note that you have a PR ready for review. diff --git a/README.md b/README.md index 2047a05..ce0169d 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,4 @@ lando php web/core/scripts/drupal generate-theme --starterkit starter_theme my_n lando drush cr ``` -## Remove these lines from your custom theme info file -``` -hidden: true -starterkit: true -``` - ## Install the theme dependencies and set your custom theme as the default diff --git a/bixaluswds.breakpoints.yml b/bixaluswds.breakpoints.yml new file mode 100644 index 0000000..d02ccd3 --- /dev/null +++ b/bixaluswds.breakpoints.yml @@ -0,0 +1,21 @@ +bixaluswds.mobile: + label: USWDS Mobile + mediaQuery: '' + weight: 0 + multipliers: + - 1x + group: 'Bixal USWDS' +bixaluswds.tablet: + label: USWDS Tablet + mediaQuery: '(min-width: 640px)' + weight: 1 + multipliers: + - 1x + group: 'Bixal USWDS' +bixaluswds.desktop: + label: USWDS Desktop + mediaQuery: '(min-width: 1024px)' + weight: 2 + multipliers: + - 1x + group: 'Bixal USWDS' diff --git a/bixaluswds.info.yml b/bixaluswds.info.yml index a65dc9d..7268fc6 100644 --- a/bixaluswds.info.yml +++ b/bixaluswds.info.yml @@ -3,13 +3,16 @@ type: theme description: "Drupal base theme for use with USWDS. Check the README for further instructions." core_version_requirement: "^10" base theme: false -version: '0.0.0' +version: '1.0.0' hidden: true dependencies: - drupal:twig_tweak - drupal:twig_field_value - drupal:uswds_templates - drupal:block_content_template + - drupal:breakpoint + - drupal:responsive_image + - drupal:focal_point regions: admin: "Admin" diff --git a/bixaluswds.theme b/bixaluswds.theme index 5f37537..eb843fa 100644 --- a/bixaluswds.theme +++ b/bixaluswds.theme @@ -6,6 +6,7 @@ */ require_once dirname(__FILE__) . '/preprocess/global.inc'; +require_once dirname(__FILE__) . '/preprocess/block.inc'; require_once dirname(__FILE__) . '/preprocess/form.inc'; require_once dirname(__FILE__) . '/preprocess/navigation.inc'; require_once dirname(__FILE__) . '/preprocess/taxonomy.inc'; diff --git a/config/install/image.style.bixal_banner_lg.yml b/config/install/image.style.bixal_banner_lg.yml new file mode 100644 index 0000000..469faa9 --- /dev/null +++ b/config/install/image.style.bixal_banner_lg.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_banner_lg +label: 'Bixal: Banner large (1280x640)' +effects: + 4d7960b9-77d5-4377-a8da-34c652f632c2: + uuid: 4d7960b9-77d5-4377-a8da-34c652f632c2 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1280 + height: 640 + crop_type: focal_point diff --git a/config/install/image.style.bixal_banner_md.yml b/config/install/image.style.bixal_banner_md.yml new file mode 100644 index 0000000..e8ffdd7 --- /dev/null +++ b/config/install/image.style.bixal_banner_md.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_banner_md +label: 'Bixal: Banner medium (960x480)' +effects: + 8169038f-d05b-4690-9982-2181ee2cd32e: + uuid: 8169038f-d05b-4690-9982-2181ee2cd32e + id: focal_point_scale_and_crop + weight: 1 + data: + width: 960 + height: 480 + crop_type: focal_point diff --git a/config/install/image.style.bixal_banner_xl.yml b/config/install/image.style.bixal_banner_xl.yml new file mode 100644 index 0000000..b52542a --- /dev/null +++ b/config/install/image.style.bixal_banner_xl.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_banner_xl +label: 'Bixal: Banner x-large (1600x800)' +effects: + b80768f3-ae67-4c0e-afb9-79f120ee49a1: + uuid: b80768f3-ae67-4c0e-afb9-79f120ee49a1 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1600 + height: 800 + crop_type: focal_point diff --git a/config/install/image.style.bixal_scaled_lg.yml b/config/install/image.style.bixal_scaled_lg.yml new file mode 100644 index 0000000..dc3501d --- /dev/null +++ b/config/install/image.style.bixal_scaled_lg.yml @@ -0,0 +1,14 @@ +langcode: en +status: true +dependencies: { } +name: bixal_scaled_lg +label: 'Bixal: Scaled large (1280)' +effects: + a0962518-9cc3-414e-9225-1c691f797150: + uuid: a0962518-9cc3-414e-9225-1c691f797150 + id: image_scale + weight: 1 + data: + width: 1280 + height: null + upscale: false diff --git a/config/install/image.style.bixal_scaled_md.yml b/config/install/image.style.bixal_scaled_md.yml new file mode 100644 index 0000000..0896b9f --- /dev/null +++ b/config/install/image.style.bixal_scaled_md.yml @@ -0,0 +1,14 @@ +langcode: en +status: true +dependencies: { } +name: bixal_scaled_md +label: 'Bixal: Scaled medium (960)' +effects: + 89836321-33a7-46d3-9328-ef2a0061c544: + uuid: 89836321-33a7-46d3-9328-ef2a0061c544 + id: image_scale + weight: 1 + data: + width: 960 + height: null + upscale: false diff --git a/config/install/image.style.bixal_scaled_sm.yml b/config/install/image.style.bixal_scaled_sm.yml new file mode 100644 index 0000000..252ba6f --- /dev/null +++ b/config/install/image.style.bixal_scaled_sm.yml @@ -0,0 +1,14 @@ +langcode: en +status: true +dependencies: { } +name: bixal_scaled_sm +label: 'Bixal: Scaled small (640)' +effects: + d4607d8c-1bb7-44a6-bea8-3e4953d2def5: + uuid: d4607d8c-1bb7-44a6-bea8-3e4953d2def5 + id: image_scale + weight: 1 + data: + width: 640 + height: null + upscale: false diff --git a/config/install/image.style.bixal_social_standard.yml b/config/install/image.style.bixal_social_standard.yml new file mode 100644 index 0000000..50e3922 --- /dev/null +++ b/config/install/image.style.bixal_social_standard.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_social_standard +label: 'Bixal: Social Standard (1200x600)' +effects: + e20979d8-82fd-433a-b785-cab50d36713f: + uuid: e20979d8-82fd-433a-b785-cab50d36713f + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1200 + height: 600 + crop_type: focal_point diff --git a/config/install/image.style.bixal_square_lg.yml b/config/install/image.style.bixal_square_lg.yml new file mode 100644 index 0000000..17b3452 --- /dev/null +++ b/config/install/image.style.bixal_square_lg.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_square_lg +label: 'Bixal: Square large (1280x1280)' +effects: + eb889b46-565b-4ae2-ba44-886e461bf29a: + uuid: eb889b46-565b-4ae2-ba44-886e461bf29a + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1280 + height: 1280 + crop_type: focal_point diff --git a/config/install/image.style.bixal_square_md.yml b/config/install/image.style.bixal_square_md.yml new file mode 100644 index 0000000..b2ffbd3 --- /dev/null +++ b/config/install/image.style.bixal_square_md.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_square_md +label: 'Bixal: Square medium (960x960)' +effects: + 38ba02eb-a159-4879-9b87-b6008ac27618: + uuid: 38ba02eb-a159-4879-9b87-b6008ac27618 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 960 + height: 960 + crop_type: focal_point diff --git a/config/install/image.style.bixal_square_sm.yml b/config/install/image.style.bixal_square_sm.yml new file mode 100644 index 0000000..b47c24f --- /dev/null +++ b/config/install/image.style.bixal_square_sm.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_square_sm +label: 'Bixal: Square small (640x640)' +effects: + b03ff1df-cb8f-43ee-83cf-8c5b1ea17e2b: + uuid: b03ff1df-cb8f-43ee-83cf-8c5b1ea17e2b + id: focal_point_scale_and_crop + weight: 1 + data: + width: 640 + height: 640 + crop_type: focal_point diff --git a/config/install/image.style.bixal_standard_lg.yml b/config/install/image.style.bixal_standard_lg.yml new file mode 100644 index 0000000..f143ed0 --- /dev/null +++ b/config/install/image.style.bixal_standard_lg.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_standard_lg +label: 'Bixal: Standard large (1280x960)' +effects: + dc6c5036-24b2-421f-9e28-3506495c27ef: + uuid: dc6c5036-24b2-421f-9e28-3506495c27ef + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1280 + height: 960 + crop_type: focal_point diff --git a/config/install/image.style.bixal_standard_md.yml b/config/install/image.style.bixal_standard_md.yml new file mode 100644 index 0000000..f3218b7 --- /dev/null +++ b/config/install/image.style.bixal_standard_md.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_standard_md +label: 'Bixal: Standard medium (960x720)' +effects: + 4f67b2ad-a8fe-40ae-a393-2e4f9fa7ff4c: + uuid: 4f67b2ad-a8fe-40ae-a393-2e4f9fa7ff4c + id: focal_point_scale_and_crop + weight: 1 + data: + width: 960 + height: 720 + crop_type: focal_point diff --git a/config/install/image.style.bixal_standard_sm.yml b/config/install/image.style.bixal_standard_sm.yml new file mode 100644 index 0000000..9b4197d --- /dev/null +++ b/config/install/image.style.bixal_standard_sm.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_standard_sm +label: 'Bixal: Standard small (640x480)' +effects: + 4cb8fd11-231f-4ee2-9c06-e39816ff26c2: + uuid: 4cb8fd11-231f-4ee2-9c06-e39816ff26c2 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 640 + height: 480 + crop_type: focal_point diff --git a/config/install/image.style.bixal_wide_standard_lg.yml b/config/install/image.style.bixal_wide_standard_lg.yml new file mode 100644 index 0000000..ff2195f --- /dev/null +++ b/config/install/image.style.bixal_wide_standard_lg.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_wide_standard_lg +label: 'Bixal: Wide Standard large (1280x720)' +effects: + fb2376c1-c084-41dc-91ef-06e0458ac449: + uuid: fb2376c1-c084-41dc-91ef-06e0458ac449 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 1280 + height: 720 + crop_type: focal_point diff --git a/config/install/image.style.bixal_wide_standard_md.yml b/config/install/image.style.bixal_wide_standard_md.yml new file mode 100644 index 0000000..3a3a4fa --- /dev/null +++ b/config/install/image.style.bixal_wide_standard_md.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_wide_standard_md +label: 'Bixal: Wide Standard medium (960x540)' +effects: + 59ab9f58-c54b-4839-b0d1-497507ad3657: + uuid: 59ab9f58-c54b-4839-b0d1-497507ad3657 + id: focal_point_scale_and_crop + weight: 1 + data: + width: 960 + height: 540 + crop_type: focal_point diff --git a/config/install/image.style.bixal_wide_standard_sm.yml b/config/install/image.style.bixal_wide_standard_sm.yml new file mode 100644 index 0000000..60ac38a --- /dev/null +++ b/config/install/image.style.bixal_wide_standard_sm.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - focal_point +name: bixal_wide_standard_sm +label: 'Bixal: Wide Standard small (640x360)' +effects: + 39a5c052-fa9b-4b51-9f6f-6016e0477f0c: + uuid: 39a5c052-fa9b-4b51-9f6f-6016e0477f0c + id: focal_point_scale_and_crop + weight: 1 + data: + width: 640 + height: 360 + crop_type: focal_point diff --git a/config/install/responsive_image.styles.bixal_banner.yml b/config/install/responsive_image.styles.bixal_banner.yml new file mode 100644 index 0000000..b3e756c --- /dev/null +++ b/config/install/responsive_image.styles.bixal_banner.yml @@ -0,0 +1,25 @@ +uuid: bcfd013d-7efe-40d1-a282-647c34b3f95f +langcode: en +status: true +dependencies: + config: + - image.style.bixal_banner_md + - image.style.bixal_banner_lg + - image.style.bixal_banner_xl + theme: + - bixaluswds +id: bixal_banner +label: 'Bixal: Banner' +image_style_mappings: + - + image_mapping_type: image_style + image_mapping: bixal_banner_xl + breakpoint_id: bixaluswds.desktop + multiplier: 1x + - + image_mapping_type: image_style + image_mapping: bixal_banner_lg + breakpoint_id: bixaluswds.tablet + multiplier: 1x +breakpoint_group: 'Bixal USWDS' +fallback_image_style: bixal_banner_md diff --git a/config/install/responsive_image.styles.bixal_scaled.yml b/config/install/responsive_image.styles.bixal_scaled.yml new file mode 100644 index 0000000..90aa952 --- /dev/null +++ b/config/install/responsive_image.styles.bixal_scaled.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - image.style.bixal_scaled_lg + - image.style.bixal_scaled_md + - image.style.bixal_scaled_sm + theme: + - bixaluswds +id: bixal_scaled +label: 'Bixal: Scaled' +image_style_mappings: + - + image_mapping_type: image_style + image_mapping: bixal_scaled_lg + breakpoint_id: bixaluswds.desktop + multiplier: 1x + - + image_mapping_type: image_style + image_mapping: bixal_scaled_md + breakpoint_id: bixaluswds.tablet + multiplier: 1x +breakpoint_group: 'Bixal USWDS' +fallback_image_style: bixal_scaled_sm diff --git a/config/install/responsive_image.styles.bixal_square.yml b/config/install/responsive_image.styles.bixal_square.yml new file mode 100644 index 0000000..30b4297 --- /dev/null +++ b/config/install/responsive_image.styles.bixal_square.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - image.style.bixal_square_lg + - image.style.bixal_square_sm + - image.style.bixal_square_md + theme: + - bixaluswds +id: bixal_square +label: 'Bixal: Square' +image_style_mappings: + - + image_mapping_type: image_style + image_mapping: bixal_square_lg + breakpoint_id: bixaluswds.desktop + multiplier: 1x + - + image_mapping_type: image_style + image_mapping: bixal_square_md + breakpoint_id: bixaluswds.tablet + multiplier: 1x +breakpoint_group: 'Bixal USWDS' +fallback_image_style: bixal_square_sm diff --git a/config/install/responsive_image.styles.bixal_standard.yml b/config/install/responsive_image.styles.bixal_standard.yml new file mode 100644 index 0000000..941e0e1 --- /dev/null +++ b/config/install/responsive_image.styles.bixal_standard.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - image.style.bixal_standard_lg + - image.style.bixal_standard_sm + - image.style.bixal_standard_md + theme: + - bixaluswds +id: bixal_standard +label: 'Bixal: Standard' +image_style_mappings: + - + image_mapping_type: image_style + image_mapping: bixal_standard_lg + breakpoint_id: bixaluswds.desktop + multiplier: 1x + - + image_mapping_type: image_style + image_mapping: bixal_standard_md + breakpoint_id: bixaluswds.tablet + multiplier: 1x +breakpoint_group: 'Bixal USWDS' +fallback_image_style: bixal_standard_sm diff --git a/config/install/responsive_image.styles.bixal_wide_standard.yml b/config/install/responsive_image.styles.bixal_wide_standard.yml new file mode 100644 index 0000000..0ede617 --- /dev/null +++ b/config/install/responsive_image.styles.bixal_wide_standard.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - image.style.bixal_wide_standard_lg + - image.style.bixal_wide_standard_sm + - image.style.bixal_wide_standard_md + theme: + - bixaluswds +id: bixal_wide_standard +label: 'Bixal: Wide Standard' +image_style_mappings: + - + image_mapping_type: image_style + image_mapping: bixal_wide_standard_lg + breakpoint_id: bixaluswds.desktop + multiplier: 1x + - + image_mapping_type: image_style + image_mapping: bixal_wide_standard_md + breakpoint_id: bixaluswds.tablet + multiplier: 1x +breakpoint_group: 'Bixal USWDS' +fallback_image_style: bixal_wide_standard_sm diff --git a/logo.svg b/logo.svg deleted file mode 100644 index 7a96faa..0000000 --- a/logo.svg +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/preprocess/block.inc b/preprocess/block.inc new file mode 100644 index 0000000..0c004a8 --- /dev/null +++ b/preprocess/block.inc @@ -0,0 +1,13 @@ +getCurrentLanguage(); $variables['language'] = $language->getId(); $variables['uswds_img_path'] = '/themes/custom/bixaluswds/dist/img'; + $variables['class_prefix'] = 'bx-'; } diff --git a/starter_theme/README.md b/starter_theme/README.md index 4c0cf58..cea01d9 100644 --- a/starter_theme/README.md +++ b/starter_theme/README.md @@ -14,7 +14,6 @@ NVM: https://github.com/nvm-sh/nvm ``` nvm use npm install -npm run build ``` ## npm commands diff --git a/starter_theme/config/install/block.block.bixaluswds_main_menu.yml b/starter_theme/config/install/block.block.bixaluswds_main_menu.yml new file mode 100644 index 0000000..91bce50 --- /dev/null +++ b/starter_theme/config/install/block.block.bixaluswds_main_menu.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - system.menu.main + module: + - system + theme: + - starter_theme +id: bixaluswds_main_menu +theme: starter_theme +region: header +weight: 0 +provider: null +plugin: 'system_menu_block:main' +settings: + id: 'system_menu_block:main' + label: 'Main navigation' + label_display: '0' + provider: system + level: 1 + depth: 2 + expand_all_items: true +visibility: { } diff --git a/starter_theme/config/install/block.block.bixaluswds_sitebranding.yml b/starter_theme/config/install/block.block.bixaluswds_sitebranding.yml new file mode 100644 index 0000000..390b47b --- /dev/null +++ b/starter_theme/config/install/block.block.bixaluswds_sitebranding.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + module: + - system + theme: + - starter_theme +id: bixaluswds_sitebranding +theme: starter_theme +region: header +weight: -2 +provider: null +plugin: system_branding_block +settings: + id: system_branding_block + label: 'Site branding' + label_display: '0' + provider: system + use_site_logo: true + use_site_name: true + use_site_slogan: false +visibility: { } diff --git a/starter_theme/config/install/block.block.starter_theme_content.yml b/starter_theme/config/install/block.block.starter_theme_content.yml new file mode 100644 index 0000000..4c954e9 --- /dev/null +++ b/starter_theme/config/install/block.block.starter_theme_content.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - system + theme: + - starter_theme +id: starter_theme_content +theme: starter_theme +region: content +weight: -3 +provider: null +plugin: system_main_block +settings: + id: system_main_block + label: 'Main page content' + label_display: '0' + provider: system +visibility: { } diff --git a/starter_theme/config/install/block.block.starter_theme_messages.yml b/starter_theme/config/install/block.block.starter_theme_messages.yml new file mode 100644 index 0000000..86fb5bd --- /dev/null +++ b/starter_theme/config/install/block.block.starter_theme_messages.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - system + theme: + - starter_theme +id: starter_theme_messages +theme: starter_theme +region: admin +weight: -3 +provider: null +plugin: system_messages_block +settings: + id: system_messages_block + label: 'Status messages' + label_display: '0' + provider: system +visibility: { } diff --git a/starter_theme/config/install/block.block.starter_theme_page_title.yml b/starter_theme/config/install/block.block.starter_theme_page_title.yml new file mode 100644 index 0000000..e18205f --- /dev/null +++ b/starter_theme/config/install/block.block.starter_theme_page_title.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + theme: + - starter_theme +id: starter_theme_page_title +theme: starter_theme +region: content +weight: -4 +provider: null +plugin: page_title_block +settings: + id: page_title_block + label: 'Page title' + label_display: '0' + provider: core +visibility: { } diff --git a/starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml b/starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml new file mode 100644 index 0000000..13229d3 --- /dev/null +++ b/starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + theme: + - starter_theme +id: starter_theme_primary_local_tasks +theme: starter_theme +region: admin +weight: -4 +provider: null +plugin: local_tasks_block +settings: + id: local_tasks_block + label: 'Primary tabs' + label_display: '0' + provider: core + primary: true + secondary: false +visibility: { } diff --git a/starter_theme/gulpfile.js b/starter_theme/gulpfile.js index a4a38f1..c63c04c 100644 --- a/starter_theme/gulpfile.js +++ b/starter_theme/gulpfile.js @@ -1,6 +1,65 @@ const uswds = require("@uswds/compile"); const {parallel, watch, series, src} = require("gulp"); const gulp = require("gulp"); +const uglifyes = require('uglify-es'); +const composer = require('gulp-uglify/composer'); +const uglify = composer(uglifyes, console); + +const settings = { + sass: { + src: ['./src/sass/**/*.scss'] + }, + js: { + dest: './dist/js', + minDest: './dist/js/min', + minSrc: './src/js/**/*.js', + src: './src/js/**/*.js', + } +} + +// JS build function. +function buildJS() { + return src(settings.js.src) + .pipe(uglify()) + .pipe(gulp.dest(settings.js.dest)); +} + +// Watch changes on JS files and trigger functions at the end. +function watchJSFiles() { + watch( + [ + './src/js/**/*.js' + ], + { + events: 'all', + ignoreInitial: false + }, + series( + buildJS + ) + ); +} + +// Compile CSS from scss. +function buildCompStyles() { + return src(settings.sass.src); +} + +// Watch changes on sass files and trigger functions at the end. +function watchCompFiles() { + watch( + [ + './src/sass/**/*.scss', + ], + { + events: 'all', + ignoreInitial: false + }, + series( + buildCompStyles + ) + ); +} /** * USWDS version @@ -15,11 +74,11 @@ uswds.settings.version = 3; */ uswds.paths.dist.theme = './src/sass'; -uswds.paths.src.projectSass = './src/sass'; uswds.paths.dist.css = './dist/css'; -uswds.paths.dist.img = './dist/img'; -uswds.paths.dist.fonts = './dist/fonts'; +uswds.paths.dist.img = './dist/assets/img'; +uswds.paths.dist.fonts = './dist/assets/fonts'; uswds.paths.dist.js = './dist/js'; +uswds.paths.src.projectSass = './src/sass'; /** * Exports @@ -27,8 +86,8 @@ uswds.paths.dist.js = './dist/js'; */ // Various compile functions. -exports.default = series(uswds.copyAssets, uswds.compile); -exports.init = uswds.init; +exports.build = series(uswds.copyAssets, buildJS, uswds.compile); exports.compile = uswds.compile; +exports.default = exports.watch = parallel(watchCompFiles, uswds.watch, watchJSFiles); exports.update = uswds.updateUswds; exports.copyAssets = uswds.copyAssets; diff --git a/starter_theme/logo.svg b/starter_theme/logo.svg new file mode 100644 index 0000000..058a6f7 --- /dev/null +++ b/starter_theme/logo.svg @@ -0,0 +1,3 @@ + diff --git a/starter_theme/package.json b/starter_theme/package.json index b337a02..5624016 100644 --- a/starter_theme/package.json +++ b/starter_theme/package.json @@ -4,13 +4,21 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "npx gulp" + "postinstall": "npx gulp build", + "build": "npx gulp build", + "dev": "npx gulp" }, "author": "", "license": "ISC", "devDependencies": { - "@uswds/compile": "^1.0.0", - "@uswds/uswds": "^3.6.1" + "@uswds/compile": "^1.1.0", + "@uswds/uswds": "^3.8.1", + "gulp": "^5.0.0", + "gulp-uglify": "^3.0.2", + "uglify-es": "^3.3.9" + }, + "overrides": { + "glob-parent": "6.0.2", + "postcss": "^8.4.31" } } diff --git a/starter_theme/src/js/external-links.js b/starter_theme/src/js/external-links.js new file mode 100644 index 0000000..4252e50 --- /dev/null +++ b/starter_theme/src/js/external-links.js @@ -0,0 +1,24 @@ +/* + Processing External Links + */ + +(() => { + + // Enable external links behavior. + // `extlinkjs-ignore` attribute should be added to all icons in order to not render the uswds external links icon + const externalLinks = document.querySelectorAll('a[href^="https"]:not([extlinkjs-ignore])'); + const title_translated = Drupal.t('External link opens in new window'); + + // Process external links. + if (externalLinks.length) { + for (let i = 0; i < externalLinks.length; i++) { + externalLinks[i].classList.add('usa-link--external'); + externalLinks[i].setAttribute('target', '_blank'); + externalLinks[i].setAttribute('title', title_translated); + if (!new URL(externalLinks[i].href).hostname.endsWith(".gov")) { + externalLinks[i].setAttribute('rel', 'noreferrer'); + } + } + } + +})(); diff --git a/starter_theme/src/js/theme-switcher.js b/starter_theme/src/js/theme-switcher.js new file mode 100644 index 0000000..50046b2 --- /dev/null +++ b/starter_theme/src/js/theme-switcher.js @@ -0,0 +1,46 @@ +/* + * Theme UI data attribute switcher + * Example: + * + */ + +(() => { + const switchBtn = document.querySelectorAll("button[data-ui-switch-id]"); + const targetContainer = document.documentElement; + + function switchInit(item) { + const id = item.getAttribute('data-ui-switch-id'); + let values = item.getAttribute('data-values'); + let currentIndex = 0; + + if (id && values) { + const storedSwitch = sessionStorage.getItem(id); + const attr = `data-${id}`; + // Split the string value into an array of values + values = values.trim().split(/,\s*/); + + function switchTrigger() { + // once function is called move to the next item in themes array and then loop back at the end of the list + currentIndex = (currentIndex + 1) % values.length; + targetContainer.setAttribute(attr, values[currentIndex]); + // set theme selection in local storage + sessionStorage.setItem(id, values[currentIndex]); + } + + if (storedSwitch) { + // Set the current theme index based on the stored value + let storedValue = currentIndex = values.indexOf(storedSwitch); + targetContainer.setAttribute(attr, values[storedValue]); + } + + item.addEventListener('click', switchTrigger); + } + } + + switchBtn.forEach(switchInit); +})(); diff --git a/starter_theme/src/sass/_uswds-settings.scss b/starter_theme/src/sass/_uswds-settings.scss new file mode 100644 index 0000000..6a5f1ad --- /dev/null +++ b/starter_theme/src/sass/_uswds-settings.scss @@ -0,0 +1,217 @@ +/* + ***** Do not write any custom CSS on this file, this is for USWDS settings only. + ***** For all possible overrides, see https://designsystem.digital.gov/documentation/settings/ +---------------------------------------- +USWDS theme settings overrides +---------------------------------------- +// Grid settings reference +---------------------------------------- +Grid container max-width +---------------------------------------- +mobile +mobile-lg +tablet +tablet-lg +desktop +desktop-lg +widescreen +---------------------------------------- +// Units available for usage. +example with USWDS units: +.element { + padding-bottom: units('first value in the key pairs below') +} + +Or a USWDS mixin... + +.element { + @include u-padding-bottom('3'); +} + +"1px": 1px, +"2px": 2px, +"05": 0.25rem, +1: 0.5rem, +"105": 0.75rem, +2: 1rem, +"205": 1.25rem, +3: 1.5rem, +"neg-1px": -1px, +"neg-2px": -2px, +"neg-05": -0.25rem, +"neg-1": -0.5rem, +"neg-105": -0.75rem, +"neg-2": -1rem, +"neg-205": -1.25rem, +"neg-3": -1.5rem, +4: 2rem, +5: 2.5rem, +6: 3rem, +7: 3.5rem, +8: 4rem, +9: 4.5rem, +10: 5rem, +15: 7.5rem, +"neg-4": -2rem, +"neg-5": -2.5rem, +"neg-6": -3rem, +"neg-7": -3.5rem, +"neg-8": -4rem, +"neg-9": -4.5rem, +"neg-10": -5rem, +"neg-15": -7.5rem, +"card": 10rem, +"card-lg": 15rem, +"mobile": 20rem, +"mobile-lg": 30rem, +"tablet": 40rem, +"tablet-lg": 55rem, +"desktop": 64rem, +"desktop-lg": 75rem, +"widescreen": 87.5rem, +0: 0, +"auto": auto +*/ + +// ****** Do not write any custom CSS on this file ****** // +/* Theme setting documentation --------------------------------------------------------------- +https://designsystem.digital.gov/documentation/settings/ + */ +@use "uswds-core" with ( + // General settings. + $theme-image-path: "../assets/img", + $theme-font-path: "../assets/fonts", + $theme-show-notifications: false, + //$theme-global-content-styles: true, + + // Component container max-widths. + $theme-grid-container-max-width: "widescreen", + $theme-banner-max-width: "widescreen", + $theme-header-max-width: "widescreen", + $theme-identifier-max-width: "widescreen", + $theme-footer-max-width: "widescreen", + $theme-site-alert-max-width: "widescreen", + $max-width-settings: ( + output: true, + responsive: true, // Max width settings, set responsive to true. + ), + + /* Color token documentation: + https://designsystem.digital.gov/design-tokens/color/theme-tokens/ + https://designsystem.digital.gov/design-tokens/color/overview/ + */ + // Color settings --------------------------------------------------------------- + //$test-system-color-tokens: false, // Debug output for system colors. + + // -- Primary + // -- Secondary + // -- Accent cool + // -- Accent warm + // -- Info + + // Component settings --------------------------------------------------------------- + // -- Accordion + // -- Alert + // -- Banner + // -- Breadcrumb + // -- Button + // -- Card + // -- Checkbox + // -- Collection + // -- Footer + // -- Form + // -- Header + // -- Hero + // -- Icon list + // -- Identifier + // -- In-page navigation + // -- Input + // -- Link + // -- Modal + // -- Navigation + $theme-header-min-width: 'tablet-lg', + // -- Pagination + // -- Process list + // -- Radio buttons + // -- Search + // -- Sidenav + // -- Site Alert + // -- Step indicator + // -- Summary box + // -- Tables + // -- Tooltip + // **** End Components **** + + // Spacing settings --------------------------------------------------------------- + $theme-column-gap-sm: 3, + $theme-column-gap-md: 4, + $theme-column-gap-lg: 6, + $theme-column-gap-mobile: 5, + //$theme-column-gap-desktop: 7, + //$theme-site-margins-width: 10, + //$theme-site-margins-mobile-width: 3, + //$theme-site-margins-breakpoint: 'tablet', + + // Typography settings --------------------------------------------------------------- + /* Typography settings and token documentation: + https://designsystem.digital.gov/documentation/settings/#typography-settings + https://designsystem.digital.gov/design-tokens/typesetting/overview/ + https://designsystem.digital.gov/utilities/font-size-and-family/ + https://designsystem.digital.gov/design-tokens/typesetting/font-family/ + */ + // Set some reasonable typography defaults. + //$theme-font-type-sans: "roboto", + //$theme-font-type-serif: "merriweather", + //$theme-font-role-ui: "sans", + //$theme-font-role-heading: "sans", + //$theme-font-role-body: "sans", + //$theme-font-role-alt: "sans", + $theme-text-measure: none, // Set standard line-length to 100% + $theme-lead-measure: none, + $theme-lead-line-height: 5, + $theme-lead-font-size: 8, + //$theme-body-font-family: "sans", + $theme-body-line-height: 5, + $theme-body-font-size: 5, + $theme-style-body-element: "true", + + // https://designsystem.digital.gov/design-tokens/typesetting/font-size/ + $theme-h1-font-size: 15, + $theme-h2-font-size: 11, + $theme-h3-font-size: 10, + $theme-h4-font-size: 9, + $theme-h5-font-size: 8, + $theme-h6-font-size: 7, + + // $theme-typeface-tokens: ( + // "roboto": ( + // "display-name": "Roboto", // or other font + // "cap-height": 364px, // the default, leave it for now + // "stack": "Helvetica, Arial, sans-serif", // or whatever stack you want + // ), + //), + + // Utilities settings --------------------------------------------------------------- + // Example of a custom utility class + // compiles as .bottom-100 { bottom:100px!important } + //$bottom-manual-values: ("80": 80px), + //$top-manual-values: ("6": 6px), + + // Turn on or off breakpoints + $theme-utility-breakpoints: ( + 'card': false, // 160px + 'card-lg': false, // 240px + 'mobile': false, // 320px + 'mobile-lg': false, // 480px + 'tablet': true, // 640px + 'tablet-lg': true, // 880px + 'desktop': true, // 1024px + 'desktop-lg': true, // 1200px + 'widescreen': false, // 1400px + ), + $flex-direction-settings: ( + output: true, + responsive: true, + ), +); +// ****** Do not write any custom CSS on this file ****** // diff --git a/starter_theme/src/sass/_uswds-theme-custom-styles.scss b/starter_theme/src/sass/_uswds-theme-custom-styles.scss deleted file mode 100644 index 8411eec..0000000 --- a/starter_theme/src/sass/_uswds-theme-custom-styles.scss +++ /dev/null @@ -1,23 +0,0 @@ -/* -* * * * * ============================== -* * * * * ============================== -* * * * * ============================== -* * * * * ============================== -======================================== -======================================== -======================================== ----------------------------------------- -USWDS THEME CUSTOM STYLES ----------------------------------------- -!! Copy this file to your project's - sass root. Don't edit the version - in node_modules. ----------------------------------------- -Custom project SASS goes here. - -i.e. -@include u-padding-right('05'); ----------------------------------------- -*/ - -@use "uswds-core" as *; diff --git a/starter_theme/src/sass/_uswds-theme.scss b/starter_theme/src/sass/_uswds-theme.scss deleted file mode 100644 index eead761..0000000 --- a/starter_theme/src/sass/_uswds-theme.scss +++ /dev/null @@ -1,15 +0,0 @@ -/* ----------------------------------------- -USWDS with settings overrides ----------------------------------------- -Uncomment the following lines and add a list of changed settings -in the form $setting: value, ----------------------------------------- -*/ - -// -// @use "uswds-core" with ( -// $setting: value, -// $setting: value -// ); -// diff --git a/starter_theme/src/sass/styles.scss b/starter_theme/src/sass/styles.scss index 6897863..8f53b80 100644 --- a/starter_theme/src/sass/styles.scss +++ b/starter_theme/src/sass/styles.scss @@ -1,3 +1,13 @@ -@forward "uswds-theme"; +// ****** Do not write any custom CSS on this file ****** // + +// Theme settings overrides. +@forward "uswds-settings"; + +// USWDS individual components +// to include everything, just code it as @forward "uswds"; @forward "uswds"; -@forward "uswds-theme-custom-styles"; + +// Custom styles +//@use "uswds-overrides"; + +// ****** Do not write any custom CSS on this file ****** // diff --git a/starter_theme/starter_theme.info.yml b/starter_theme/starter_theme.info.yml index 4a62b2d..e51ba17 100644 --- a/starter_theme/starter_theme.info.yml +++ b/starter_theme/starter_theme.info.yml @@ -3,7 +3,6 @@ type: theme description: "Drupal theme for use with USWDS." core_version_requirement: "^10" base theme: bixaluswds -starterkit: true version: '0.0.0' hidden: true diff --git a/starter_theme/starter_theme.libraries.yml b/starter_theme/starter_theme.libraries.yml index ce2db37..8fc96e1 100644 --- a/starter_theme/starter_theme.libraries.yml +++ b/starter_theme/starter_theme.libraries.yml @@ -2,6 +2,7 @@ base: version: VERSION dependencies: - starter_theme/uswds + - starter_theme/external_links uswds: version: VERSION @@ -11,3 +12,13 @@ uswds: js: dist/js/uswds-init.js: {} dist/js/uswds.js: {} + +external_links: + version: VERSION + js: + dist/js/external-links.js: { minified: true } + +#theme_switcher: +# version: VERSION +# js: +# dist/js/theme-switcher.js: { minified: true } diff --git a/starter_theme/starter_theme.starterkit.yml b/starter_theme/starter_theme.starterkit.yml new file mode 100644 index 0000000..68bce45 --- /dev/null +++ b/starter_theme/starter_theme.starterkit.yml @@ -0,0 +1,2 @@ +info: + version: VERSION diff --git a/starter_theme/starter_theme.theme b/starter_theme/starter_theme.theme index fed14b7..4d4e58e 100644 --- a/starter_theme/starter_theme.theme +++ b/starter_theme/starter_theme.theme @@ -9,5 +9,5 @@ * Implements hook_preprocess(). */ function starter_theme_preprocess(&$variables) { - $variables['uswds_img_path'] = '/themes/custom/starter_theme/dist/img'; + $variables['uswds_img_path'] = '/themes/custom/starter_theme/dist/assets/img'; } diff --git a/templates/_components/uswds/usa-footer.html.twig b/templates/_components/uswds/usa-footer.html.twig index 7d182e9..8702c5c 100644 --- a/templates/_components/uswds/usa-footer.html.twig +++ b/templates/_components/uswds/usa-footer.html.twig @@ -77,7 +77,7 @@ {% for item in social_icons %} {% if item.url %}