Skip to content

Commit

Permalink
SDSS-595 | SDSS-596: Add Newsroom menu (#189)
Browse files Browse the repository at this point in the history
* SDSS-595 | SDSS-596: Add Newsroom menu.
  • Loading branch information
joegl authored Dec 7, 2023
1 parent ab744c8 commit 592f3f5
Show file tree
Hide file tree
Showing 56 changed files with 15,191 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
id: sdss_subtheme_main_navigation
theme: sdss_subtheme
region: menu
weight: 0
weight: -7
provider: null
plugin: 'system_menu_block:main'
settings:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
uuid: f201744b-060d-4755-8e64-87457fbfe0a0
langcode: en
status: true
dependencies:
config:
- system.menu.newsroom
module:
- config_pages
- menu_block
- system
theme:
- sdss_subtheme
id: sdss_subtheme_newsresearch
theme: sdss_subtheme
region: newsroom
weight: 0
provider: null
plugin: 'menu_block:newsroom'
settings:
id: 'menu_block:newsroom'
label: 'News & Research'
label_display: visible
provider: menu_block
follow: false
follow_parent: child
label_link: false
label_type: menu
level: 1
depth: 0
expand_all_items: false
parent: 'newsroom:'
suggestion: newsroom
visibility:
request_path:
id: request_path
negate: false
pages: '/news*'
config_pages_values_access:
id: config_pages_values_access
negate: false
config_page_field: sdss_site_settings|su_sdss_newsroom_menu|boolean
operator: '=='
condition_value: '1'
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dependencies:
config:
- views.view.search
module:
- config_pages
- views
theme:
- sdss_subtheme
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
uuid: e0b45054-d297-43b9-8312-67e2004e620f
langcode: en
status: true
dependencies: { }
id: sdss_site_settings
label: 'SDSS Site Settings'
token: false
context:
show_warning: true
group:
language: false
fallback:
language: ''
menu:
path: /admin/config/system/sdss-site-settings
weight: 0
description: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: d1a391ed-c0a2-427b-8a86-20d718f89d1e
langcode: en
status: true
dependencies:
config:
- config_pages.type.sdss_site_settings
- field.field.config_pages.sdss_site_settings.su_sdss_newsroom_menu
id: config_pages.sdss_site_settings.default
targetEntityType: config_pages
bundle: sdss_site_settings
mode: default
content:
su_sdss_newsroom_menu:
type: boolean_checkbox
weight: 22
region: content
settings:
display_label: true
third_party_settings: { }
hidden:
label: true
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ third_party_settings:
children:
- group_site_details
- group_contact_details
- group_sdss_settings
label: Tabs
region: content
parent_name: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uuid: cc470cf0-4163-4268-843b-9377d7d986a1
langcode: en
status: true
dependencies:
config:
- config_pages.type.sdss_site_settings
- field.field.config_pages.sdss_site_settings.su_sdss_newsroom_menu
id: config_pages.sdss_site_settings.default
targetEntityType: config_pages
bundle: sdss_site_settings
mode: default
content:
su_sdss_newsroom_menu:
type: boolean
label: above
settings:
format: default
format_custom_false: ''
format_custom_true: ''
third_party_settings: { }
weight: 19
region: content
hidden:
search_api_excerpt: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 2bc11c45-ddac-4ba3-b701-748c8f33deb6
langcode: en
status: true
dependencies:
config:
- config_pages.type.sdss_site_settings
- field.storage.config_pages.su_sdss_newsroom_menu
id: config_pages.sdss_site_settings.su_sdss_newsroom_menu
field_name: su_sdss_newsroom_menu
entity_type: config_pages
bundle: sdss_site_settings
label: 'Show Newsroom Menu'
description: 'Enable the Newsroom menu on /news paths.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
on_label: Enable
off_label: Disable
field_type: boolean
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entity_type: config_pages
bundle: stanford_basic_site_settings
label: 'Accessibility Contact Email'
description: '<p>Please enter the email for the person(s) who are responsible for site content. (This may be the same as the Primary Site Manager in many cases.)</p>'
required: true
required: false
translatable: false
default_value: { }
default_value_callback: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ entity_type: config_pages
bundle: stanford_basic_site_settings
label: Organization
description: ''
required: true
required: false
translatable: false
default_value: { }
default_value_callback: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entity_type: config_pages
bundle: stanford_basic_site_settings
label: 'Site Owner Contact Email'
description: '<p>Please enter the email for the business owner(s) for this site. This might be the director, chair, program owner, lab PI, etc.</p>'
required: true
required: false
translatable: false
default_value: { }
default_value_callback: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entity_type: config_pages
bundle: stanford_basic_site_settings
label: 'Primary Site Manager Email'
description: '<p>Please enter the email for the person(s) who leads the site building and editing efforts for this site.</p>'
required: true
required: false
translatable: false
default_value: { }
default_value_callback: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
uuid: f6a3e4e7-8ba3-48c8-8bfe-9820fc3dd892
langcode: en
status: true
dependencies:
module:
- config_pages
id: config_pages.su_sdss_newsroom_menu
field_name: su_sdss_newsroom_menu
entity_type: config_pages
type: boolean
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ dependencies:
- scheduler
third_party_settings:
menu_ui:
available_menus: { }
parent: ''
available_menus:
- newsroom
parent: 'newsroom:'
node_revision_delete:
minimum_revisions_to_keep: 5
minimum_age_to_delete: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
uuid: 19d118e4-99e6-4f8c-ba61-f3cdc83e0105
langcode: en
status: true
dependencies: { }
id: newsroom
label: 'News & Research'
description: 'Newsroom menu'
locked: false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"semi": false,
"endOfLine": "auto"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* Gets size stats for built islands.
*/
const { basename, join } = require('path')
const { green, red, yellow, white } = require('kleur')
const gzipSize = require('gzip-size')
const brotliSize = require('brotli-size')
const prettyBytes = require('pretty-bytes')
const fs = require('fs/promises')

/**
*
* Sauce pulled from here:
* https://github.com/developit/microbundle/blob/ecb0b022912397bcf98550c1a783e9e0534f33e5/src/lib/compressed-size.js
*/
function getPadLeft(str, width, char = ' ') {
return char.repeat(width - str.length)
}

function formatSize(size, filename, suffix, raw) {
const pretty = raw ? `${size} B` : prettyBytes(size)
const color = size < 5000 ? green : size > 40000 ? red : yellow
const indent = getPadLeft(pretty, 13)
return `${indent}${color(pretty)}: ${white(basename(filename))}${suffix}`
}

async function getSizeInfo(path, filename) {
const code = await fs.readFile(path)

const [original, gzip, brotli] = await Promise.all([
fs.stat(path).then((x) => x.size),
gzipSize(code).catch(() => null),
brotliSize.sync(code),
])

const raw = original < 5000

let out = formatSize(original, filename, '', raw)

out += '\n' + formatSize(gzip, filename, '.gz', raw)

if (brotli) {
out += '\n' + formatSize(brotli, filename, '.br', raw)
}

return out
}

class FileSizePlugin {
apply(compiler) {
compiler.hooks.done.tap(
'File Size Plugin',
async (
stats /* stats is passed as an argument when done hook is tapped. */,
) => {
const promises = []
stats.compilation.assetsInfo.forEach((value, key) => {
const filePath = join(stats.compilation.outputOptions.path, key)
promises.push(getSizeInfo(filePath, key))
})

const resolve = await Promise.all(promises)

resolve.map((log) => console.log(log))
},
)
}
}

module.exports = FileSizePlugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html><head><meta charset="utf-8"/><title>Islands</title><meta name="viewport" content="width=device-width,initial-scale=1"/><style>body {
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.preview {
width: 100%;
max-width: 1500px;
margin: 80px auto;
border: 1px dashed rgba(0, 0, 0, 0.2);
position: relative;
}

.preview::before {
content: 'Island';
position: absolute;
display: block;
top: -18px;
font-size: 11px;
color: rgba(0, 0, 0, 0.5);
}</style><script defer="defer" src="/islands/newsroom-menu.island.umd.js"></script></head><body><div class="preview"><div data-island="newsroom-menu-island"></div></div></body></html>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Loading

0 comments on commit 592f3f5

Please sign in to comment.