Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fontawesome 6 #969

Merged
merged 4 commits into from
Sep 25, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions components/Accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const Accordion = ({ children, icon, iconColor, title }) => {
return (
<details className="Accordion" onToggle={() => setIsOpen(!isOpen)}>
<summary className="Accordion-title">
<i className={`Accordion-toggleIcon${isOpen ? '_opened' : ''} fa fa-chevron-right`}></i>
{icon && <i className={`Accordion-icon fa ${icon}`} style={{ color: `${iconColor}` }}></i>}
{title}
<i className={`Accordion-toggleIcon${isOpen ? '_opened' : ''} <i class="fa fa-regular fa-chevron-right"></i>`}></i>
{icon && <i className={`Accordion-icon fa-duotone fa-solid ${icon}`} style={{ color: `${iconColor}` }}></i>}
rafegoldberg marked this conversation as resolved.
Show resolved Hide resolved
{title}
</summary>
<div className="Accordion-content">{children}</div>
</details>
Expand Down
4 changes: 2 additions & 2 deletions components/Callout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
right: 100%;
width: 2.4em;
text-align: center;
font: normal normal normal 1em/1 FontAwesome;
font: normal normal normal 1em/1 var(--icon-font);
}
}
.callout-icon {
Expand All @@ -102,7 +102,7 @@
}
@mixin calloutCustomIcons($R: callout) {
--emoji: 1em;
--icon-font: FontAwesome;
--icon-font: var(--fa-style-family, 'Font Awesome 6 Pro');
Copy link
Contributor

@rafegoldberg rafegoldberg Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, will this --fa-style-family var allow users to customize the FontAwesome style automagically? And if so, why do we need to add the extra class elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! This is one way you can customize the icon style, but it would apply across all uses of FA. Would make it harder to mix-and-match. It’s also probably lesser known, since they don’t make it very prominent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sick, so much cleaner than having to add a million extra classes.

&-icon {
font-size: var(--emoji, 0);
color: var(--icon-color, inherit) !important;
Expand Down
2 changes: 1 addition & 1 deletion components/Cards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Card = ({ children, href, icon, iconColor, target, title }) => {
const Tag = href ? 'a' : 'div';
return (
<Tag className="Card" href={href} target={target}>
{icon && <i className={`Card-icon fa ${icon}`} style={{ color: `${iconColor}` }}></i>}
{icon && <i className={`Card-icon fa-duotone fa-solid ${icon}`} style={{ color: `${iconColor}` }}></i>}
{title && <p className='Card-title'>{title}</p>}
<div className="Card-content">{children}</div>
</Tag>
Expand Down
2 changes: 1 addition & 1 deletion components/Heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Heading = ({ tag: Tag = 'h3', depth = 3, id, children, ...attrs }: Props)
<a
key={`heading-anchor-icon-${id}`}
aria-label={`Skip link to ${children}`}
className="heading-anchor-icon fa fa-anchor"
className="heading-anchor-icon fa fa-regular fa-anchor"
href={`#${id}`}
/>
</Tag>
Expand Down
4 changes: 2 additions & 2 deletions components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const Tabs = ({ children }) => {
<div className="TabGroup">
<header>
<nav className="TabGroup-nav">
{children?.map((tab, index: number) =>
{children?.map((tab, index: number) =>
<button className={`TabGroup-tab${activeTab === index ? '_active' : ''}`} key={tab.props.title} onClick={() => setActiveTab(index)}>
{tab.props.icon && <i className={`TabGroup-icon fa ${tab.props.icon}`} style={{ color: `${tab.props.iconColor}` }}></i>}
{tab.props.icon && <i className={`TabGroup-icon fa-duotone fa-solid ${tab.props.icon}`} style={{ color: `${tab.props.iconColor}` }}></i>}
{tab.props.title}
</button>
)}
Expand Down
8 changes: 6 additions & 2 deletions docs/callouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Callouts come in [various themes](#section--examples-). These can be customized
--border: #8b939c;
}
```

```scss Theme Selectors
.markdown-body .callout.callout_default {
} /* gray */
Expand All @@ -108,11 +109,13 @@ Each callout will also have a `theme` attribute that's set to it's emoji prefix.
--text: #f5fffa;
}
```

```markdown Markdown Syntax
> 🎅 Old Saint Nick
>
> 'Twas the night before Christmas, when all through the house not a creature was stirring, not even a mouse. The stockings were hung by the chimney with care, in hopes that St. Nicholas soon would be there. The children were nestled all snug in their beds, while visions of sugar plums danced in their heads.
```

```html Generated HTML
<!-- condensed for clarity! -->
<blockquote class="callout callout_default" theme="🎅">
Expand Down Expand Up @@ -140,10 +143,11 @@ With a touch of Custom CSS, we should be able to get a callout using the 📷 em
```css Custom CSS
.callout[theme='📷'] {
--emoji: unset;
--icon: '\f083'; /* copied from FontAwesome */
--icon: '\f030'; /* https://fontawesome.com/icons/camera?f=classic&s=solid */
--icon-color: #c50a50;
}
```

```Markdown Syntax
> 📷 Cool pix!
>
Expand Down Expand Up @@ -187,7 +191,7 @@ The custom icon font defaults to `FontAwesome`, but you can use any font family

```css
.callout[theme='📷'] {
--icon-font-family: FontAwesome; /* copied from https://fontawesome.com/v4.7.0/icon/camera-retro */
--icon-font: 'Font Awesome 6 Pro';
}
```

Expand Down
Loading