File tree 9 files changed +86
-7
lines changed
project_styleguide/templates/patterns
molecules/streamfield/blocks
9 files changed +86
-7
lines changed Original file line number Diff line number Diff line change @@ -973,6 +973,27 @@ class NumericStatisticsBlock(blocks.StructBlock):
973
973
974
974
class Meta :
975
975
icon = "table"
976
+ label_format = "{headline_number} {description} {further_details}"
977
+
978
+
979
+ class NumericStatisticsGroupBlock (blocks .StructBlock ):
980
+ title = blocks .CharBlock (max_length = 255 , required = False )
981
+ intro = blocks .RichTextBlock (
982
+ features = settings .NO_HEADING_RICH_TEXT_FEATURES , required = False
983
+ )
984
+ statistics = blocks .ListBlock (
985
+ NumericStatisticsBlock (),
986
+ max_num = 4 ,
987
+ min_num = 1 ,
988
+ )
989
+
990
+ class Meta :
991
+ group = "Custom"
992
+ icon = "table"
993
+ label = "Numeric statistics"
994
+ template = (
995
+ "patterns/molecules/streamfield/blocks/numeric_stats_group_block.html"
996
+ )
976
997
977
998
978
999
class TextualStatisticsBlock (blocks .StructBlock ):
Original file line number Diff line number Diff line change 2
2
FeaturedServicesBlock ,
3
3
FourPhotoCollageBlock ,
4
4
IntroductionWithImagesBlock ,
5
+ NumericStatisticsGroupBlock ,
5
6
PartnersBlock ,
6
7
StoryBlock ,
7
8
)
10
11
class DivisionStoryBlock (StoryBlock ):
11
12
four_photo_collage = FourPhotoCollageBlock ()
12
13
introduction_with_images = IntroductionWithImagesBlock ()
14
+ numeric_statistics = NumericStatisticsGroupBlock ()
13
15
partners_block = PartnersBlock ()
14
16
featured_services = FeaturedServicesBlock ()
Original file line number Diff line number Diff line change
1
+ {% load wagtailcore_tags wagtailimages_tags %}
2
+ < div class ="grid__stats-group stats-group ">
3
+ {% if value.title %}
4
+ {% include "patterns/atoms/motif-heading/motif-heading.html" with heading_level=2 heading=value.title classes="motif-heading motif-heading--two-c motif-heading--static stats-group__heading" %}
5
+ {% endif %}
6
+ {% if value.intro %}
7
+ < div class ="text text--five stats-group__intro "> {{ value.intro|richtext }}</ div >
8
+ {% endif %}
9
+ {# Stats #}
10
+ {# Not sure if the impact report page (which uses stats_numeric.html) should be affected. #}
11
+ {% include "patterns/molecules/streamfield/blocks/stats_numeric.html" with value=value.statistics %}
12
+ </ div >
Original file line number Diff line number Diff line change
1
+ context :
2
+ value :
3
+ title : Lighting little fires
4
+ intro : ' Torchbox has been supporting charities since the start of the digital era. Some of the stats we're particularly proud of:'
5
+ statistics :
6
+ - headline_number : 120
7
+ description : charities
8
+ further_details : and counting...
9
+ - headline_number : 24
10
+ description : years
11
+ further_details : working with the sector
12
+ - headline_number : ' 263%'
13
+ description : traffic increase
14
+ further_details : for an imaginary charity
15
+ - headline_number : 1
16
+ description : Guinness record
17
+ further_details : working with the DEC
Original file line number Diff line number Diff line change @@ -109,6 +109,11 @@ <h2 class="underline mt-8 mb-2">Stats block textual</h2>
109
109
{% include "patterns/molecules/streamfield/blocks/stats_textual.html" %}
110
110
</ div >
111
111
112
+ < div >
113
+ < h2 class ="underline mt-8 mb-2 "> Numeric stats group block</ h2 >
114
+ {% include "patterns/molecules/streamfield/blocks/numeric_stats_group_block.html" %}
115
+ </ div >
116
+
112
117
< div >
113
118
< h2 class ="underline mt-8 mb-2 "> Event block</ h2 >
114
119
{% include "patterns/molecules/streamfield/blocks/event_block.html" %}
Original file line number Diff line number Diff line change 101
101
}
102
102
103
103
& __related-posts-simple ,
104
- & __team-listing {
104
+ & __team-listing ,
105
+ & __stats-group {
105
106
grid-column : 2 / span 4 ;
106
107
107
108
@include media-query (large ) {
Original file line number Diff line number Diff line change
1
+ @use ' config' as * ;
2
+
3
+ .stats-group {
4
+ & __heading {
5
+ margin-bottom : $spacer-mini ;
6
+
7
+ @include media-query (' large' ) {
8
+ max-width : 50% ;
9
+ }
10
+ }
11
+
12
+ & __intro {
13
+ margin-bottom : $spacer-medium ;
14
+
15
+ @include media-query (' large' ) {
16
+ margin-bottom : $spacer-half ;
17
+ max-width : 60% ;
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change 36
36
37
37
& __number {
38
38
@include font-size (size- zero);
39
- color : var (--color--heading );
39
+ color : var (--color--theme-primary );
40
40
display : block ;
41
- font-weight : $weight--light ;
42
- line-height : 1 ;
41
+ font-weight : $weight--semibold ;
43
42
}
44
43
45
44
& __text {
51
50
}
52
51
53
52
& __description {
54
- @include font-size (' size-five' );
53
+ @include font-size (' size-four' );
54
+ font-weight : $weight--semibold ;
55
55
color : var (--color--heading );
56
56
display : block ;
57
- margin-bottom : $spacer-mini ;
57
+ line-height : 1 ;
58
58
}
59
59
60
60
& __details {
61
- @include font-size (' size-eight ' );
61
+ @include font-size (' size-seven ' );
62
62
display : block ;
63
63
}
64
64
}
Original file line number Diff line number Diff line change 44
44
@use ' components/markdown-block' ;
45
45
@use ' components/mode-switcher' ;
46
46
@use ' components/motif-heading' ;
47
+ @use ' components/stats-group' ;
47
48
@use ' components/pagination' ;
48
49
@use ' components/partners' ;
49
50
@use ' components/photo-collage' ;
You can’t perform that action at this time.
0 commit comments