81 lines
2 KiB
Text
81 lines
2 KiB
Text
# Footer Configuration Defaults and Helpers
|
|
#
|
|
# Provides helper functions for creating footer items with minimal duplication.
|
|
|
|
let contracts = import "contracts.ncl" in
|
|
|
|
{
|
|
# Helper function: Create a footer menu item
|
|
#
|
|
# Usage:
|
|
# make_footer_item {
|
|
# id = "privacy",
|
|
# routes = { en = "/privacy", es = "/privacidad" },
|
|
# labels = { en = "Privacy Policy", es = "Política de Privacidad" },
|
|
# icon = "fas fa-shield-alt",
|
|
# }
|
|
#
|
|
# Parameters:
|
|
# config: Record with id, routes, labels, and optional icon/priority
|
|
#
|
|
# Returns: FooterMenuItem record
|
|
make_footer_item
|
|
| Dyn -> Dyn
|
|
= fun config =>
|
|
{
|
|
id = config.id,
|
|
routes = config.routes,
|
|
labels = config.labels,
|
|
is_external = false,
|
|
enabled = true,
|
|
priority = -1,
|
|
}
|
|
& (if std.record.has_field "icon" config then { icon = config.icon } else {})
|
|
& (if std.record.has_field "priority" config then { priority = config.priority } else {})
|
|
& (if std.record.has_field "enabled" config then { enabled = config.enabled } else {}),
|
|
|
|
# Helper function: Create a social link
|
|
#
|
|
# Usage:
|
|
# make_social_link "LinkedIn" "https://linkedin.com/in/user" "fab fa-linkedin"
|
|
#
|
|
# Parameters:
|
|
# social_name: Social network name
|
|
# profile_url: Full URL to profile
|
|
# icon: Icon class
|
|
#
|
|
# Returns: SocialLink record
|
|
make_social_link
|
|
| String -> String -> String -> Dyn
|
|
= fun social_name profile_url icon =>
|
|
{
|
|
name = social_name,
|
|
url = profile_url,
|
|
icon_class = icon,
|
|
enabled = true,
|
|
},
|
|
|
|
# Helper function: Create bilingual text
|
|
#
|
|
# Usage:
|
|
# bilingual "English text" "Texto español"
|
|
#
|
|
# Parameters:
|
|
# en_text: English text
|
|
# es_text: Spanish text
|
|
#
|
|
# Returns: BilingualText record
|
|
bilingual
|
|
| String -> String -> Dyn
|
|
= fun en_text es_text =>
|
|
{
|
|
en = en_text,
|
|
es = es_text,
|
|
},
|
|
|
|
# Common footer priorities
|
|
priorities = {
|
|
footer_only = -1,
|
|
hidden = -999,
|
|
},
|
|
}
|