Skip to content

Commit

Permalink
feat: fontawesome 6 (#969)
Browse files Browse the repository at this point in the history
[![PR App][icn]][demo] | Fix RM-XYZ
:-------------------:|:----------:

## 🧰 Changes

Should be able to have this go live before the `readme` changes. Keeping
the (no longer used) `.fa` classes should be enough for backwards
compatibility.

## 🧬 QA & Testing

- [Broken on production][prod].
- [Working in this PR app][demo].


[demo]: https://markdown-pr-PR_NUMBER.herokuapp.com
[prod]: https://SUBDOMAIN.readme.io
[icn]:
https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
  • Loading branch information
runnabro committed Sep 25, 2024
1 parent 2d9fffc commit 6360191
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
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>}
{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');
&-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

0 comments on commit 6360191

Please sign in to comment.