Skip to content

Commit

Permalink
separate link and ctas, add cta config
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWoodward committed Jul 25, 2024
1 parent ae816c7 commit e6dd16c
Show file tree
Hide file tree
Showing 2 changed files with 1,006 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pages/custom_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,38 @@ def get_api_representation(self, value, context=None):
return None


class CTALinkBlock(blocks.StructBlock):
class LinkInfoBlock(blocks.StructBlock):
text = blocks.CharBlock(required=True)
aria_label = blocks.CharBlock(required=False)
target = LinkBlock(required=True)

class Meta:
icon = 'placeholder'
label = "Link"

class CTALinkBlock(LinkInfoBlock):
text = blocks.CharBlock(required=True)
aria_label = blocks.CharBlock(required=False)
target = LinkBlock(required=True)
config = blocks.StreamBlock([
('style', blocks.ChoiceBlock(choices=[
('primary', 'Primary'),
('white', 'White'),
('blue-outline', 'Blue Outline'),
('deep-green', 'Deep Green Outline'),
], default='descending')),
], block_counts={
'style': {'max_num': 1},
}, required=False)

class Meta:
icon = 'placeholder'
label = "Call to Action"


class LinksGroupBlock(blocks.StructBlock):
links = blocks.ListBlock(
CTALinkBlock(required=False, label="Link"),
LinkInfoBlock(required=False, label="Link"),
default=[], label='Links'
)
config = blocks.StreamBlock([
Expand Down
Loading

0 comments on commit e6dd16c

Please sign in to comment.