Skip to content

Commit

Permalink
feat: new name, import method, docs badges
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianCataldo committed Oct 15, 2022
1 parent ca27fa6 commit f44b9c7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
26 changes: 17 additions & 9 deletions components/Link/README.md
@@ -1,5 +1,14 @@
# 🚀  Astro — Link, with smart optimizations

[![NPM](https://img.shields.io/npm/v/@julian_cataldo/astro-link)](https://www.npmjs.com/package/@julian_cataldo/astro-link)
![Downloads](https://img.shields.io/npm/dt/@julian_cataldo/astro-link.svg)
[![ISC License](https://img.shields.io/npm/l/@julian_cataldo/astro-link)](https://github.com/JulianCataldo/web-garden/blob/develop/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
[![TypeScript](https://img.shields.io/badge/TypeScript-333333.svg?logo=typescript)](http://www.typescriptlang.org/)
[![Prettier](https://img.shields.io/badge/Prettier-333333.svg?logo=prettier)](https://prettier.io)
[![EditorConfig](https://img.shields.io/badge/EditorConfig-333333.svg?logo=editorconfig)](https://editorconfig.org)
[![ESLint](https://img.shields.io/badge/ESLint-3A33D1?logo=eslint)](https://eslint.org)

Supercharge your links.
This component detects external / anchor / same domain / mail / telephone
**`href`**, and apply optimizations accordingly.
Expand Down Expand Up @@ -29,14 +38,14 @@ You can then style these globally with `:global(.link.is-mail)` for example.
## 📦  Installation

```sh
pnpm i @julian_cataldo/astro-link
pnpm i astro-link
```

## 🛠  Usage

```astro
---
import Link from '@julian_cataldo/astro-link/Link.astro';
import { Link } from 'astro-link';
// ...
---
```
Expand All @@ -62,10 +71,10 @@ import Link from '@julian_cataldo/astro-link/Link.astro';

```astro
<a
href='https://www.juliancataldo.com'
class='link is-external astro-H4CCARKM'
rel='noopener nofollow'
target='_blank'
href="https://www.juliancataldo.com"
class="link is-external astro-H4CCARKM"
rel="noopener nofollow"
target="_blank"
>
Some external link, loaded in a new tab
</a>
Expand All @@ -83,7 +92,7 @@ Of course, as links are ubiquitous in any website, it's totally valid to style t
Semi-scoped styles inside parent (it won't effect upstream, only downstream):

```astro
<style lang='scss'>
<style lang="scss">
.my-parent-with-custom-links {
// Use `:global` as a localized escape hatch:
Expand All @@ -106,7 +115,7 @@ Semi-scoped styles inside parent (it won't effect upstream, only downstream):
Global styles (in your layout component, for example):

```astro
<style lang='scss' is:global>
<style lang="scss" is:global>
a.link {
font-weight: 700;
color: green;
Expand All @@ -118,7 +127,6 @@ Global styles (in your layout component, for example):
## To do

- [ ] Support Astro `base` option for prefixing `href`s.
- [ ] Proper support for opening link in new tab (ctrl/cmd/middle-mouse + click)

<div class="git-footer">

Expand Down
3 changes: 0 additions & 3 deletions components/Link/index.js

This file was deleted.

5 changes: 5 additions & 0 deletions components/Link/index.ts
@@ -0,0 +1,5 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import Link from './Link.astro';

export { Link };
10 changes: 8 additions & 2 deletions components/Link/package.json
@@ -1,12 +1,18 @@
{
"name": "@julian_cataldo/astro-link",
"version": "0.12.7",
"name": "astro-link",
"version": "1.0.0",
"description": "Supercharge your links. This component detects external / anchor / same domain / mail / telephone `href`, and apply optimizations accordingly.",
"main": "index.js",
"type": "module",
"publishConfig": {
"access": "public"
},
"files": [
"index.ts",
"Props.ts",
"Link.astro",
"CHANGELOG.md"
],
"author": "Julian Cataldo",
"homepage": "https://code.juliancataldo.com/component/astro-link",
"bugs": {
Expand Down

0 comments on commit f44b9c7

Please sign in to comment.