From b66011de5ad79d7264a58a5bcb210a54231e583b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 21 Mar 2022 16:38:41 +0530 Subject: [PATCH 01/11] feat(website): added new templates to page builder and refactored typography to be more consistent --- frappe/public/scss/desk/avatar.scss | 4 +- frappe/public/scss/website/base.scss | 67 +++++++++-- frappe/public/scss/website/blog.scss | 4 +- frappe/public/scss/website/index.scss | 2 +- frappe/public/scss/website/markdown.scss | 112 ++---------------- frappe/public/scss/website/page_builder.scss | 102 +++++++++++----- frappe/public/scss/website/variables.scss | 2 +- frappe/templates/includes/avatar_macro.html | 16 +-- frappe/templates/includes/blog/blogger.html | 7 +- frappe/templates/includes/web_block.html | 7 +- .../website/doctype/blog_post/blog_post.json | 6 +- .../blog_post/templates/blog_post_row.html | 4 +- frappe/website/doctype/web_page/web_page.js | 2 +- .../web_page_block/web_page_block.json | 37 +++++- frappe/website/js/website.js | 13 ++ .../web_template/cover_image/__init__.py | 0 .../web_template/cover_image/cover_image.html | 5 + .../web_template/cover_image/cover_image.json | 34 ++++++ .../full_width_image/full_width_image.json | 4 +- frappe/website/web_template/hero/hero.html | 4 +- frappe/website/web_template/hero/hero.json | 3 +- .../section_with_cta/section_with_cta.html | 8 +- .../section_with_small_cta.html | 8 +- .../section_with_testimonials/__init__.py | 0 .../section_with_testimonials.html | 31 +++++ .../section_with_testimonials.json | 73 ++++++++++++ .../section_with_videos/__init__.py | 0 .../section_with_videos.html | 24 ++++ .../section_with_videos.json | 61 ++++++++++ 29 files changed, 460 insertions(+), 180 deletions(-) create mode 100644 frappe/website/web_template/cover_image/__init__.py create mode 100644 frappe/website/web_template/cover_image/cover_image.html create mode 100644 frappe/website/web_template/cover_image/cover_image.json create mode 100644 frappe/website/web_template/section_with_testimonials/__init__.py create mode 100644 frappe/website/web_template/section_with_testimonials/section_with_testimonials.html create mode 100644 frappe/website/web_template/section_with_testimonials/section_with_testimonials.json create mode 100644 frappe/website/web_template/section_with_videos/__init__.py create mode 100644 frappe/website/web_template/section_with_videos/section_with_videos.html create mode 100644 frappe/website/web_template/section_with_videos/section_with_videos.json diff --git a/frappe/public/scss/desk/avatar.scss b/frappe/public/scss/desk/avatar.scss index cc8c16ce44..638256c21d 100644 --- a/frappe/public/scss/desk/avatar.scss +++ b/frappe/public/scss/desk/avatar.scss @@ -111,8 +111,8 @@ } .avatar-large { - width: 72px; - height: 72px; + width: 64px; + height: 64px; .standard-image { font-size: var(--text-2xl); diff --git a/frappe/public/scss/website/base.scss b/frappe/public/scss/website/base.scss index 4190780ece..324397552d 100644 --- a/frappe/public/scss/website/base.scss +++ b/frappe/public/scss/website/base.scss @@ -1,3 +1,13 @@ +$font-size-xs: 0.7rem; +$font-size-sm: 0.85rem; +$font-size-lg: 1.12rem; +$font-size-xl: 1.25rem; +$font-size-2xl: 1.5rem; +$font-size-3xl: 2rem; +$font-size-4xl: 2.5rem; +$font-size-5xl: 3rem; +$font-size-6xl: 4rem; + html { height: 100%; } @@ -16,43 +26,74 @@ img { h1 { font-size: $font-size-3xl; - font-weight: 800; line-height: 1.25; letter-spacing: -0.025em; - margin-bottom: 1rem; + margin-top: 3rem; + margin-bottom: 0.75rem; @include media-breakpoint-up(sm) { + font-size: $font-size-5xl; line-height: 2.5rem; - font-size: $font-size-4xl; + margin-top: 3.5rem; + margin-bottom: 1.25rem; } @include media-breakpoint-up(xl) { + font-size: $font-size-6xl; line-height: 1; - font-size: $font-size-5xl; + margin-top: 4rem; } } h2 { - font-size: $font-size-xl; - font-weight: 700; + font-size: $font-size-2xl; + margin-top: 2rem; margin-bottom: 0.75rem; @include media-breakpoint-up(sm) { - font-size: $font-size-2xl; - } - @include media-breakpoint-up(md) { font-size: $font-size-3xl; + margin-top: 4rem; + margin-bottom: 1rem; + } + @include media-breakpoint-up(xl) { + font-size: $font-size-4xl; + margin-top: 4rem; } } h3 { - font-size: $font-size-base; - font-weight: 600; + font-size: $font-size-xl; + margin-top: 1.5rem; margin-bottom: 0.5rem; @include media-breakpoint-up(sm) { - font-size: $font-size-lg; + font-size: $font-size-2xl; + margin-top: 2.5rem; + } + @include media-breakpoint-up(xl) { + font-size: $font-size-3xl; + margin-top: 3.5rem; } - @include media-breakpoint-up(md) { +} + +h4 { + font-size: $font-size-lg; + margin-top: 1rem; + margin-bottom: 0.5rem; + + @include media-breakpoint-up(sm) { font-size: $font-size-xl; + margin-top: 1.25rem; } + @include media-breakpoint-up(xl) { + font-size: $font-size-2xl; + margin-top: 1.75rem; + } + + a { + color: $body-color; + } +} + +.btn.btn-lg { + font-size: $font-size-lg; } diff --git a/frappe/public/scss/website/blog.scss b/frappe/public/scss/website/blog.scss index 6b0acb9d83..99255df764 100644 --- a/frappe/public/scss/website/blog.scss +++ b/frappe/public/scss/website/blog.scss @@ -57,12 +57,12 @@ .blog-card-footer { display: flex; - align-items: center; + align-items: top; margin-top: 0.5rem; .avatar { + margin-top: 0.4rem; margin-right: 0.5rem; - border-radius: 50%; } } } diff --git a/frappe/public/scss/website/index.scss b/frappe/public/scss/website/index.scss index e36e649eb7..4352301b4c 100644 --- a/frappe/public/scss/website/index.scss +++ b/frappe/public/scss/website/index.scss @@ -5,7 +5,6 @@ @import "../common/global"; @import "../common/icons"; @import "../common/alert"; -@import 'base'; @import "../common/flex"; @import "../common/buttons"; @import "../common/modal"; @@ -14,6 +13,7 @@ @import "../common/indicator"; @import "../common/controls"; @import "../common/awesomeplete"; +@import 'base'; @import 'multilevel_dropdown'; @import 'website_image'; @import 'website_avatar'; diff --git a/frappe/public/scss/website/markdown.scss b/frappe/public/scss/website/markdown.scss index 6f009df393..c2592b61e9 100644 --- a/frappe/public/scss/website/markdown.scss +++ b/frappe/public/scss/website/markdown.scss @@ -1,30 +1,12 @@ -$font-sizes-desktop: ( - "sm": 0.75rem, - "base": 1rem, - "lg": 1.125rem, - "xl": 1.41rem, - "2xl": 1.6rem, - "3xl": 2rem -); - -$font-sizes-mobile: ( - "sm": 0.75rem, - "base": 1rem, - "lg": 1.125rem, - "xl": 1.25rem, - "2xl": 1.5rem, - "3xl": 1.75rem -); + +.section-markdown > .from-markdown { + max-width: 50rem; + margin: auto; +} .from-markdown { color: $gray-700; line-height: 1.7; - letter-spacing: -0.011em; - - > * + * { - margin-top: 0.75rem; - margin-bottom: 0; - } > :first-child { margin-top: 0; @@ -47,6 +29,10 @@ $font-sizes-mobile: ( list-style: decimal; } + p, li { + font-size: $font-size-lg; + } + li { padding-top: 1px; padding-bottom: 1px; @@ -87,86 +73,6 @@ $font-sizes-mobile: ( font-weight: 600; } - h1, h2, h3, h4, h5, h6 { - color: $gray-900; - } - - h2, h3, h4, h5, h6 { - font-weight: 600; - } - - h1 { - font-size: map-get($font-sizes-mobile, '3xl'); - line-height: 1.5; - letter-spacing: -0.021em; - font-weight: 700; - - @include media-breakpoint-up(md) { - font-size: map-get($font-sizes-desktop, '3xl'); - letter-spacing: -0.024em; - } - - // for byline - & + p { - margin-top: 1.5rem; - font-size: map-get($font-sizes-mobile, 'xl'); - letter-spacing: -0.014em; - line-height: 1.4; - - @include media-breakpoint-up(md) { - font-size: map-get($font-sizes-desktop, 'xl'); - letter-spacing: -0.0175em; - } - } - } - - h2 { - font-size: map-get($font-sizes-mobile, '2xl'); - line-height: 1.56; - letter-spacing: -0.015em; - margin-top: 4rem; - - @include media-breakpoint-up(md) { - font-size: map-get($font-sizes-desktop, '2xl'); - letter-spacing: -0.0195em; - } - } - - h3 { - font-size: map-get($font-sizes-mobile, 'xl'); - line-height: 1.56; - letter-spacing: -0.014em; - margin-top: 2.25rem; - - @include media-breakpoint-up(md) { - font-size: map-get($font-sizes-desktop, 'xl'); - letter-spacing: -0.0175em; - } - } - - h4 { - font-size: map-get($font-sizes-mobile, 'lg'); - line-height: 1.56; - letter-spacing: -0.014em; - margin-top: 2.5rem; - } - - h5 { - font-size: map-get($font-sizes-mobile, 'base'); - line-height: 1.5; - letter-spacing: -0.011em; - font-weight: 600; - margin-top: 2rem; - } - - h6 { - font-size: map-get($font-sizes-mobile, 'sm'); - line-height: 1.35; - font-weight: 600; - text-transform: uppercase; - margin-top: 1.5rem; - } - tr > td, tr > th { font-size: $font-size-sm; diff --git a/frappe/public/scss/website/page_builder.scss b/frappe/public/scss/website/page_builder.scss index e7e2f8b242..f94f79df21 100644 --- a/frappe/public/scss/website/page_builder.scss +++ b/frappe/public/scss/website/page_builder.scss @@ -1,4 +1,7 @@ .hero-content { + margin-top: 3rem; + margin-bottom: 3rem; + .btn-primary { margin-top: 1rem; margin-right: 0.5rem; @@ -15,16 +18,23 @@ .hero-title, .hero-subtitle { max-width: 42rem; + margin-top: 0rem; + margin-bottom: 0.5rem; +} + +.lead { + font-weight: normal; + font-size: 1.25rem; + margin-bottom: 1.5rem; } .hero-subtitle { @extend .lead; - font-weight: 400; color: $gray-600; - font-size: 1rem; + font-size: $font-size-lg; @include media-breakpoint-up(sm) { - font-size: 1.25rem; + font-size: $font-size-xl; } } @@ -42,10 +52,10 @@ .section-description { max-width: 56rem; margin-top: 0.5rem; - font-size: $font-size-base; + font-size: $font-size-lg; - @include media-breakpoint-up(lg) { - font-size: $font-size-lg; + @include media-breakpoint-up(media-breakpoint-up) { + font-size: $font-size-xl; } } @@ -226,14 +236,10 @@ } } -.section-markdown > .from-markdown { - max-width: 42rem; -} - .section-cta { padding: 3rem 2rem; text-align: center; - background-color: $primary-light; + background-color: $gray-200; border-radius: 0.75rem; @include media-breakpoint-up(sm) { @@ -248,12 +254,7 @@ .title { margin: 0 auto; max-width: 36rem; - font-size: $font-size-2xl; - font-weight: 800; line-height: 1.25; - @include media-breakpoint-up(md) { - font-size: $font-size-4xl; - } } .subtitle { max-width: 36rem; @@ -270,11 +271,15 @@ margin-top: 0.5rem; font-size: $font-size-xs; } + .action { + margin-top: 0; + margin-bottom: 0; + } } .section-small-cta { padding: 1.8rem; - background-color: lighten($primary, 42%); + background-color: var(--gray-200); border-radius: 0.75rem; display: flex; flex-direction: column; @@ -294,26 +299,27 @@ } } - .title { - max-width: 36rem; - font-size: $font-size-xl; - font-weight: 800; - line-height: 1.25; - @include media-breakpoint-up(md) { - font-size: $font-size-2xl; - } + .section-title { + line-height: 1; + margin-bottom: 0.25rem; } + .subtitle { max-width: 36rem; font-size: $font-size-base; color: $gray-900; - margin-bottom: 1.2rem; + margin-bottom: 0.5rem; @include media-breakpoint-up(md) { font-size: $font-size-lg; margin-bottom: 0px; } } + + .action { + margin-top: 0; + margin-bottom: 0; + } } .section-cta-container { @@ -379,6 +385,20 @@ } } +.testimonial-author { + margin-top: 1rem; + display: flex; + align-items: center; + + .avatar { + margin-right: 0.5rem; + } + + p { + margin-bottom: 0; + } +} + .split-section-content.align-top { margin-top: 2rem; } @@ -514,12 +534,12 @@ @include media-breakpoint-up(md) { grid-template-columns: repeat(2, 1fr); - gap: 6rem; + gap: 3rem 5rem; } .feature-title { font-size: $font-size-xl; - font-weight: bold; + font-weight: 600; @include media-breakpoint-up(md) { font-size: $font-size-2xl; @@ -528,7 +548,7 @@ .feature-content { font-size: $font-size-base; - margin-top: 1.75rem; + margin-top: 1.25rem; @include media-breakpoint-up(xl) { font-size: $font-size-lg; @@ -630,9 +650,14 @@ } } +.section-title { + margin-top: 0; + margin-bottom: 0.5rem; +} + .section-title + .section-features, .section-description + .section-features { &[data-columns="2"] { - margin-top: 3.75rem; + margin-top: 3rem; } &[data-columns="3"] { @@ -651,6 +676,10 @@ position: relative; } +.feature-title { + margin-top: 0; +} + .feature-title, .feature-content { margin-bottom: 0; } @@ -666,3 +695,16 @@ .section-with-embed .embed-container { margin-top: 2rem; } + +.section-video { + aspect-ratio: 16 / 9; + width: 100%; + cursor: pointer; + margin-bottom: 1rem; +} + +.video-thumbnail { + aspect-ratio: 16 / 9; + width: 100%; + object-fit: cover; +} diff --git a/frappe/public/scss/website/variables.scss b/frappe/public/scss/website/variables.scss index 293d02b06d..ad3dbd2f8b 100644 --- a/frappe/public/scss/website/variables.scss +++ b/frappe/public/scss/website/variables.scss @@ -58,7 +58,7 @@ $font-size-lg: 1.125rem !default; $font-size-xl: 1.25rem !default; $font-size-2xl: 1.5rem !default; $font-size-3xl: 1.875rem !default; -$font-size-4xl: 2.25rem !default; +$font-size-4xl: 2.5rem !default; $font-size-5xl: 3rem !default; $font-size-6xl: 4rem !default; diff --git a/frappe/templates/includes/avatar_macro.html b/frappe/templates/includes/avatar_macro.html index b652b573b3..49c2dfc1bc 100644 --- a/frappe/templates/includes/avatar_macro.html +++ b/frappe/templates/includes/avatar_macro.html @@ -1,18 +1,18 @@ -{% macro avatar(user_id=None, css_style=None, size="avatar-small") %} +{% macro avatar(user_id=None, css_style=None, size="avatar-small", full_name=None, image=None) %} {% set user_info = frappe.utils.get_user_info_for_avatar(user_id) %} - - {% if user_info.image %} + + {% if image or user_info.image %} + src="{{ image or user_info.image }}" + title="{{ full_name or user_info.name }}"> {% else %} - {{ frappe.utils.get_abbr(user_info.name).upper() }} + title="{{ full_name or user_info.name }}"> + {{ frappe.utils.get_abbr(full_name or user_info.name).upper() }} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/frappe/templates/includes/blog/blogger.html b/frappe/templates/includes/blog/blogger.html index 6963cc7361..bc36501ddd 100644 --- a/frappe/templates/includes/blog/blogger.html +++ b/frappe/templates/includes/blog/blogger.html @@ -1,8 +1,9 @@ -{% from "frappe/templates/includes/macros.html" import square_image_with_fallback %} +{% from "frappe/templates/includes/avatar_macro.html" import avatar %}
- {{ square_image_with_fallback(src=blogger_info.avatar, size='small', alt=blogger_info.full_name, class='align-self-start mr-4 rounded') }} -
+ {{ avatar(full_name=blogger_info.full_name, image=blogger_info.avatar, size='avatar-large') }} + +
{{ blogger_info.full_name }}
diff --git a/frappe/templates/includes/web_block.html b/frappe/templates/includes/web_block.html index 0805e743c0..c8b22b3551 100644 --- a/frappe/templates/includes/web_block.html +++ b/frappe/templates/includes/web_block.html @@ -3,6 +3,8 @@ 'section-padding-top': web_block.add_top_padding, 'section-padding-bottom': web_block.add_bottom_padding, 'bg-light': web_block.add_shade, + 'border-top': web_block.add_border_at_top, + 'border-bottom': web_block.add_border_at_bottom, }, web_block.css_class ]) -%} @@ -10,7 +12,10 @@ {%- if web_template_type == 'Section' -%} {%- if not web_block.hide_block -%}
+ data-section-template="{{ web_block.web_template | e }}" + {% if web_block.add_background_image -%} + style="background: url({{ web_block.background_image}}) no-repeat center center; background-size: cover;" + {%- endif %}> {%- if web_block.add_container -%}
{%- endif -%} diff --git a/frappe/website/doctype/blog_post/blog_post.json b/frappe/website/doctype/blog_post/blog_post.json index 5e3cc78d70..3f8407e8e2 100644 --- a/frappe/website/doctype/blog_post/blog_post.json +++ b/frappe/website/doctype/blog_post/blog_post.json @@ -113,6 +113,7 @@ "depends_on": "eval:doc.content_type === 'Markdown'", "fieldname": "content_md", "fieldtype": "Markdown Editor", + "ignore_xss_filter": 1, "label": "Content (Markdown)" }, { @@ -213,7 +214,7 @@ "index_web_pages_for_search": 1, "is_published_field": "published", "links": [], - "modified": "2022-03-09 01:48:25.227295", + "modified": "2022-03-21 14:42:19.282612", "modified_by": "Administrator", "module": "Website", "name": "Blog Post", @@ -245,6 +246,7 @@ "route": "blog", "sort_field": "modified", "sort_order": "ASC", + "states": [], "title_field": "title", "track_changes": 1 -} +} \ No newline at end of file diff --git a/frappe/website/doctype/blog_post/templates/blog_post_row.html b/frappe/website/doctype/blog_post/templates/blog_post_row.html index 53539c33e0..f8494d12b0 100644 --- a/frappe/website/doctype/blog_post/templates/blog_post_row.html +++ b/frappe/website/doctype/blog_post/templates/blog_post_row.html @@ -1,3 +1,5 @@ +{% from "frappe/templates/includes/avatar_macro.html" import avatar %} + {%- set post = doc -%}
@@ -26,7 +28,7 @@

{{ post.intro }}