Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/app/views/examples/components/hero/_preview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@
<% end %>
<% end %>

<%= sage_component SageDivider, {} %>

<h2>Shadow</h2>
<p>When the Hero has a shadow, a box-shadow will be applied to the Hero container.</p>

<%= sage_component SageHero, {
title: "Learn with Kajabi in our live workshops",
description: "Did you know we offer free workshops? Kajabi experts host live workshops every week on topics from marketing your products to building out your Kajabi account.",
image: "hero-workshop-placeholder.jpg",
alt_text: "Multi-layered illustration of UI elements and woman clasping her hands together in excitement",
size: "small",
borderless: true,
shadow: "100",
} do %>
<% content_for :sage_hero_footer_actions do %>
<%= sage_component SageButton, {
value: "Learn more",
style: "primary",
} %>
<% end %>
<% end %>

<%# This is the modal triggered from various examples in this documentation %>
<%= sage_component SageModal, { id: "cool-modal"} do %>
<%= sage_component SageModalContent, {
Expand Down
6 changes: 6 additions & 0 deletions docs/app/views/examples/components/hero/_props.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<td><%= md('Boolean') %></td>
<td><%= md('`false`') %></td>
</tr>
<tr>
<td><%= md('`shadow`') %></td>
<td><%= md('Sets the box-shadow on the Hero.') %></td>
<td><%= md('String: ["none", "050", "100", "150", "200", "300", "400", "500"]') %></td>
<td><%= md('`nil`') %></td>
</tr>
<tr>
<td><%= md('`title`') %></td>
<td><%= md('Sets the title for the component.') %></td>
Expand Down
1 change: 1 addition & 0 deletions docs/lib/sage_rails/app/sage_components/sage_hero.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SageHero < SageComponent
description: [:optional, NilClass, String],
image: [:optional, NilClass, String],
image_start: [:optional, NilClass, TrueClass],
shadow: [:optional, NilClass, SageSchemas::HERO_SHADOW],
size: [:optional, NilClass, SageSchemas::HERO_SIZE],
title: [:optional, NilClass, String],
title_tag: [:optional, NilClass, String],
Expand Down
2 changes: 2 additions & 0 deletions docs/lib/sage_rails/app/sage_tokens/sage_schemas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module SageSchemas

HERO_SIZE = Set.new(SageTokens::HERO_SIZES)

HERO_SHADOW = Set.new(SageTokens::HERO_SHADOWS)

STATUSES = Set.new(SageTokens::STATUSES)

SPACER = {
Expand Down
2 changes: 2 additions & 0 deletions docs/lib/sage_rails/app/sage_tokens/sage_tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def SageTokens.grid_templates

HERO_SIZES = ["small", "large"]

HERO_SHADOWS = ["none", "050", "100", "150", "200", "300", "400", "500"]

ICONS = [
"access-key",
"add",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<%= "sage-hero--contained" if component.contained %>
<%= "sage-hero--custom-background-color" if component.custom_background_color %>
<%= "sage-hero--image-start" if component.image_start %>
<%= "sage-hero--shadow-#{component.shadow}" if component.shadow.present? %>
<%= component.generated_css_classes %>
"
data-js-hero
Expand Down
19 changes: 19 additions & 0 deletions packages/sage-assets/lib/stylesheets/components/_hero.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ $-hero-play-icon-background-color: var(--pine-color-background-container);
}
}

// Shadow options — aligned with Pine pds-box shadow values
// Keep in sync with `packages/sage-react/lib/Hero/configs.js`
$-sage-hero-shadows: (
none: 0,
"050": sage-shadow("050"),
100: sage-shadow(100),
150: sage-shadow(150),
200: sage-shadow(200),
300: sage-shadow(300),
400: sage-shadow(400),
500: sage-shadow(500),
);

@each $-key, $-val in $-sage-hero-shadows {
.sage-hero--shadow-#{$-key} {
box-shadow: #{$-val};
}
}

.sage-hero__title {
@extend %t-sage-heading-3;
grid-area: title;
Expand Down
10 changes: 9 additions & 1 deletion packages/sage-react/lib/Hero/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Button } from '../Button';
import { HERO_SIZES } from './configs';
import { HERO_SHADOWS, HERO_SIZES } from './configs';
import { SageClassnames } from '../configs';

export const Hero = ({
Expand All @@ -17,6 +17,7 @@ export const Hero = ({
image,
imageStart,
heroSize,
shadow,
title,
titleTag,
...rest
Expand All @@ -30,6 +31,7 @@ export const Hero = ({
'sage-hero--contained': contained,
'sage-hero--image-start': imageStart,
'sage-hero--custom-background-color': customBackgroundColor,
[`sage-hero--shadow-${shadow}`]: shadow,
},
);

Expand Down Expand Up @@ -80,6 +82,7 @@ export const Hero = ({
);
};

Hero.SHADOWS = HERO_SHADOWS;
Hero.Sizes = HERO_SIZES;

Hero.defaultProps = {
Expand All @@ -97,6 +100,7 @@ Hero.defaultProps = {
},
imageStart: false,
heroSize: Hero.Sizes.LARGE,
shadow: null,
title: null,
titleTag: 'h2',
};
Expand Down Expand Up @@ -151,6 +155,10 @@ Hero.propTypes = {
* Sets the size of the Hero's width.
*/
heroSize: PropTypes.oneOf(Hero.Sizes),
/**
* Sets the box-shadow on the Hero. Aligned with Pine pds-box shadow values.
*/
shadow: PropTypes.oneOf(Object.values(Hero.SHADOWS)),
/**
* The title to be rendered within the Hero.
*/
Expand Down
18 changes: 18 additions & 0 deletions packages/sage-react/lib/Hero/Hero.story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ When the image is set to start, the image will be placed at the start of the Her
</Story>
</Canvas>

## Shadow
When the Hero has a shadow, a box-shadow will be applied to the Hero container.
<Canvas>
<Story name="Shadow">
<Hero
title="Learn with Kajabi in our live workshops"
description="Did you know we offer free workshops? Kajabi experts host live workshops every week on topics from marketing your products to building out your Kajabi account."
heroSize="small"
shadow="100"
image={{
src: `${heroFull}`,
alt: 'Multi-layered illustration of UI elements and woman clasping her hands together in excitement'
}}
footerActions={<><Button color="primary">Learn more</Button></>}
/>
</Story>
</Canvas>

## CTA Attribute
When the Hero has a CTA attribute, the CTA will be applied to the Hero image.

Expand Down
13 changes: 13 additions & 0 deletions packages/sage-react/lib/Hero/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@ export const HERO_SIZES = {
SMALL: 'small',
LARGE: 'large',
};

// Keep in sync with `packages/sage-assets/lib/stylesheets/components/_hero.scss`
// Aligned with Pine pds-box shadow values
export const HERO_SHADOWS = {
NONE: 'none',
'050': '050',
100: '100',
150: '150',
200: '200',
300: '300',
400: '400',
500: '500',
};
Loading