Advent

Day 18: Social share 🔗

A social share is a component that displays anchors holding social sharing links of a current page.

The example component is visible below.



A few notes about this social share component:

  • CSS Variables are used for colors,
  • CSS Flexbox is used for layout,
  • the gap property is used to add spacing between flex items,
  • the after pseudo-element is used to add the link icon,
  • the :first-letter selector is used to make the first letter bolder.

The code:

<div class="advent-social">
  <p>Share on:</p>
  <a href="https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.silvestar.codes%2Fside-projects%2Fadvent%2F12-18%2F" target="_blank" rel="noopener">Facebook</a>
  <a href="https://twitter.com/intent/tweet/?text=See%20Social%20Share%20and%20other%20components%20in%20Advent%20of%20UI%20Components.&amp;url=https%3A%2F%2Fwww.silvestar.codes%2Fside-projects%2Fadvent%2F12-18%2F" target="_blank" rel="noopener">Twitter</a>
  <a href="https://www.linkedin.com/shareArticle?mini=true&amp;url=https%3A%2F%2Fwww.silvestar.codes%2Fside-projects%2Fadvent%2F12-18%2F&amp;title=See%20Social%20Share%20and%20other%20components%20in%20Advent%20of%20UI%20Components.&amp;summary=See%20Social%20Share%20and%20other%20components%20in%20Advent%20of%20UI%20Components.&amp;source=https%3A%2F%2Fwww.silvestar.codes%2Fside-projects%2Fadvent%2F12-18%2F" target="_blank" rel="noopener">LinkedIn</a>
  <a href="https://reddit.com/submit/?url=https%3A%2F%2Fwww.silvestar.codes%2Fside-projects%2Fadvent%2F12-18%2F&amp;resubmit=true&amp;title=See%20Social%20Share%20and%20other%20components%20in%20Advent%20of%20UI%20Components." target="_blank" rel="noopener">Reddit</a>
</div>
.advent-social {
  --color-xmas-alpha: #f7efef;
  --color-xmas-beta: #d72621;
  --color-xmas-gamma: #639565;

  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: .5em;
}

.advent-social a {
  color: var(--color-xmas-beta);

  position: relative;
  padding-right: .75em;

  cursor: pointer;
}

.advent-social a:hover,
.advent-social a:focus,
.advent-social a:active {
  text-decoration: underline;
}

.advent-social a:first-letter {
  font-weight: bold;
}

.advent-social a:after {
  content: "🔗";

  font-size: .5rem;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 1rem;
  height: 1rem;

  position: absolute;
  top: 0;
  right: 0;

}

.advent-social p,
.advent-social a {
  display: block;
  margin: 0;
}

.advent-social p {
  font-size: .8em;
  font-weight: 300;
}

Advent of UI components 🎄

Check other UI components.

Day 24: Details 🎹

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 24: Details.

Day 23: Radio button 📱

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 23: Radio button.

Day 22: Checkbox 🧦

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 22: Checkbox.

Day 21: Notification 🤫

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 21: Notification.

Day 20: Code block 💻

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 20: Code block.

Day 19: Pagination 📖

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 19: Pagination.

Day 17: Card 🎴

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 17: Card.

Day 16: Table 🎶

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 16: Table.

Day 15: Breadcrumb 🍞

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 15: Breadcrumb.

Day 14: Blockquote 💬

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 14: Blockquote.

Day 13: List 🗒️

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 13: List.

Day 12: Figure 🖼️

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 12: Figure.

Day 11: Video embed 📺

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 11: Video embed.

Day 10: Footer 👇

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 10: Footer.

Day 9: Header ☝️

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 9: Header.

Day 8: Hero 🦸‍♂️

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 8: Hero.

Day 7: Intro 💬

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 7: Intro.

Day 6: Horizontal rule 〰️

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 6: Horizontal rule.

Day 5: Split 💔

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 5: Split.

Day 4: Banner 🚩

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 4: Banner.

Day 3: Gallery 🍿

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 3: Gallery.

Day 2: Tag 🎁

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 2: Tag.

Day 1: Button 🎅

During every day of the Advent of UI components, I am showcasing a new UI Component built with HTML, CSS, and JavaScript. Day 1: Button.