diff --git a/docs/app/views/examples/components/icon/_preview.html.erb b/docs/app/views/examples/components/icon/_preview.html.erb index e3b5cf5168..b4d9ab5b97 100644 --- a/docs/app/views/examples/components/icon/_preview.html.erb +++ b/docs/app/views/examples/components/icon/_preview.html.erb @@ -1,111 +1,83 @@ -

Basic Usage

+

Default

+ <%= sage_component SageIcon, { icon: "pen", label: "Edit" } %> -

Colors

-<%= sage_component SageCardList, {} do %> - <% SageTokens::COLORS.each do | color | %> - <%= sage_component SageCardListItem, { grid_template: "et" } do %> - <%= sage_component SageIcon, { icon: "pen", color: color } %> - <%= color %> - <% end %> - <% end %> -<% end %> - -

Sizes

-<%= sage_component SageCardList, {} do %> - <% SageTokens::ICON_SIZES.each do | size | %> - <%= sage_component SageCardListItem, { grid_template: "et" } do %> - <%= sage_component SageIcon, { icon: "pen", size: (size == "md" ? nil : size) } %> - <%= size == "md" ? "Default (#{size})" : size %> - <% end %> - <% end %> -<% end %> +

Variants

-

Alignment next to Type

-<%= md(" -Since a common use is to place an icon inline next to text in a variety of forms, we provide the opportunity to indicate that an icon is beside content a particular type spec. -The effect is that the icon's `height` and `line-height` are updated to match the spec responsively. -This can be used in combination with the different icon sizes. -and also be used with a vareity of layout techniques or components such as CSS flexbox (used below) or grid templates within `SageCardRow` or `SagePanelRow`. -") %> -
- <%= sage_component SageIcon, { icon: "check-circle", adjacent_type: "h2", spacer: { right: "xs" } } %> -

Heading 2 Lorem ipsum dolor sit

-
-
- <%= sage_component SageIcon, { icon: "check-circle", adjacent_type: "h4", spacer: { right: "xs" } } %> -

Heading 4 Lorem ipsum dolor sit

-
-
- <%= sage_component SageIcon, { icon: "check-circle", adjacent_type: "body", spacer: { right: "xs" } } %> -

Body Lorem ipsum dolor sit

+

Color

+ +

To change the color of the icon, pass a color name to the color prop. Color values are defined in Figma and include values like primary-300, sage-300, red-300, etc.

+ +
+ <%= sage_component SageIcon, { icon: "pen", label: "Edit", color: "primary-300" } %> + <%= sage_component SageIcon, { icon: "preview-on", label: "Preview", color: "sage-300" } %> + <%= sage_component SageIcon, { icon: "trash", label: "Delete", color: "red-300" } %>
-
- <%= sage_component SageIcon, { icon: "check-circle", adjacent_type: "body-sm", spacer: { right: "xs" } } %> -

Body Small Lorem ipsum dolor sit

+ +<%= sage_component SageDivider, {} %> + +

Size

+

Size can be used to increase or decrease the size of the icon. The default size is md. See Property tab for available values.

+ +
+ <%= sage_component SageIcon, { icon: "pen", label: "Edit", size: "xs" } %> + <%= sage_component SageIcon, { icon: "preview-on", label: "Edit" } %> + <%= sage_component SageIcon, { icon: "trash", label: "Edit", size: "xl" } %>
-

Background Colors

-<%= sage_component SageCardList, {} do %> - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "danger" %>

- <%= sage_component SageIcon, { icon: "danger", card_color: "danger" } %> - <%= sage_component SageIcon, { icon: "danger", card_color: "danger", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "draft" %>

- <%= sage_component SageIcon, { icon: "draft", card_color: "draft" } %> - <%= sage_component SageIcon, { icon: "draft", card_color: "draft", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "info" %>

- <%= sage_component SageIcon, { icon: "info-circle", card_color: "info" } %> - <%= sage_component SageIcon, { icon: "info-circle", card_color: "info", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "locked" %>

- <%= sage_component SageIcon, { icon: "lock", card_color: "locked" } %> - <%= sage_component SageIcon, { icon: "lock", card_color: "locked", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "published" %>

- <%= sage_component SageIcon, { icon: "window-paragraph", card_color: "published" } %> - <%= sage_component SageIcon, { icon: "window-paragraph", card_color: "published", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "warning" %>

- <%= sage_component SageIcon, { icon: "warning", card_color: "warning" } %> - <%= sage_component SageIcon, { icon: "warning", card_color: "warning", circular: true } %> - <% end %> - - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= "kajabi" %>

- <%= sage_component SageIcon, { icon: "kajabi-filled", card_color: "primary" } %> - <%= sage_component SageIcon, { icon: "kajabi-filled", card_color: "primary", circular: true } %> - <% end %> -<% end %> +<%= sage_component SageDivider, {} %> + +

Card Color

+

Icons can be placed on a background by setting the card_color property. See Property tab for available values.

+
+ <%= sage_component SageIcon, { icon: "danger", card_color: "danger" } %> + <%= sage_component SageIcon, { icon: "warning", card_color: "warning" } %> + <%= sage_component SageIcon, { icon: "check-circle", card_color: "published" } %> +
+ +<%= sage_component SageDivider, {} %>

Background Sizes

-<%= sage_component SageCardList, {} do %> - <% SageTokens::ICON_SIZES.each do | size | %> - <%= sage_component SageCardListItem, { grid_template: "o" } do %> -

<%= size == "md" ? "Default (#{size})" : size %>

- <%= sage_component SageIcon, { icon: "pen", size: (size == "md" ? nil : size), card_color: "draft" } %> - <%= sage_component SageIcon, { icon: "pen", size: (size == "md" ? nil : size), card_color: "draft", circular: true, } %> - <% end %> - <% end %> -<% end %> +

Background sizes can be applied by setting the size property. See Property tab for available values.

+ +
+ <%= sage_component SageIcon, { icon: "pen", size: "sm", card_color: "draft" } %> + <%= sage_component SageIcon, { icon: "preview-on", size: "lg", card_color: "draft" } %> + <%= sage_component SageIcon, { icon: "trash", size: "xl", card_color: "draft" } %> +
+ +<%= sage_component SageDivider, {} %>

Custom Background Sizes

-<%= sage_component SageCardList, {} do %> - <%= sage_component SageCardListItem, { grid_template: "o" } do %> - <%= sage_component SageIcon, { icon: "pen", size: "2xl", background_width: "128px", background_height: "64px", card_color: "draft" } %> - <%= sage_component SageIcon, { icon: "pen", size: "xl", background_height: "64px", card_color: "draft", circular: true, } %> - <% end %> -<% end %> +

Custom background sizes can be applied by setting the background_width and background_height properties. These values are applied as inline styles, so they can be any valid CSS value. The background_width property is required when using background_height.

+ + +
+ <%= sage_component SageIcon, { icon: "pen", background_width: "128px", background_height: "128px", card_color: "draft" } %> + <%= sage_component SageIcon, { icon: "preview-on", background_width: "64px", background_height: "128px", card_color: "warning" } %> + <%= sage_component SageIcon, { icon: "trash", background_width: "240px", background_height: "80px", card_color: "danger" } %> +
+ +<%= sage_component SageDivider, {} %> + +

Circular

+

Icons can be made circular by setting the circular property to true.

+ +
+ <%= sage_component SageIcon, { icon: "pen", card_color: "draft", circular: true } %> + <%= sage_component SageIcon, { icon: "preview-on", card_color: "published", circular: true } %> + <%= sage_component SageIcon, { icon: "trash", card_color: "danger", circular: true } %> +
+ +<%= sage_component SageDivider, {} %> + +

Alignment next to Type

+ +

The adjacent_type property can be used to align an icon next to a heading or paragraph. This is useful for placing an icon next to a heading or paragraph in a variety of forms. The effect is that the icon's height and line-height are updated to match the spec responsively. This can be used in combination with the different icon sizes and also be used with a vareity of layout techniques or components such as CSS flexbox (used below) or grid templates within SageCardRow or SagePanelRow. +

+ +
+ <%= sage_component SageIcon, { icon: "check-circle", adjacent_type: "h2", spacer: { right: "xs" } } %> +

Heading 2 Lorem ipsum dolor sit

+