# hdoc-ribbon

> hdoc-ribbon is a custom HTML element I worked on as part of my #100DaysOfCode journey to learn new stuffs and re-learn many things

Latest version **1.3.2** (published 2022-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install hdoc-ribbon
pnpm add hdoc-ribbon
yarn add hdoc-ribbon
bun add hdoc-ribbon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2022-04-03 |
| First published | 2022-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nattaphoom Chaipreecha |
| Maintainers | attomos |

## Links

- npm: https://www.npmjs.com/package/hdoc-ribbon
- Repository: https://github.com/attomos/hdoc-ribbon
- Homepage: https://github.com/attomos/hdoc-ribbon#readme
- Issues: https://github.com/attomos/hdoc-ribbon/issues
- npm.io page: https://npm.io/package/hdoc-ribbon

## Recent versions

- 1.3.2 (latest) — 2022-04-03
- 1.3.1 — 2022-04-03
- 1.3.0 — 2022-04-03
- 1.2.0 — 2022-01-22
- 1.1.0 — 2022-01-22
- 1.0.2 — 2022-01-22
- 1.0.1 — 2022-01-19
- 1.0.0 — 2022-01-18

## README

# hdoc-ribbon (100-days-of-code-ribbon)

`hdoc-ribbon` is a custom HTML element I worked on as part of my #100DaysOfCode journey to learn
new stuffs and re-learn many things

## Usage

Include this script in your HTML

```html
<script src="https://unpkg.com/hdoc-ribbon@latest/index.js"></script>
<!-- Or use specific tag -->
<script src="https://unpkg.com/hdoc-ribbon@1.2.0/index.js"></script>
```

And start using `<hdoc-ribbon>` element in your document:

```html
<!-- put the ribbon on the top right corner -->
<hdoc-ribbon
  data-day="11"
  position="right"
  href="https://github.com/attomos/100-days-of-code"
></hdoc-ribbon>

<!-- put the ribbon on the top left corner -->
<hdoc-ribbon
  data-day="100"
  position="left"
  href="https://github.com/attomos/100-days-of-code"
></hdoc-ribbon>
```

| Attribute | Data Type | Description                                      | Observed Attribute\* |
| --------- | --------- | ------------------------------------------------ | -------------------- |
| data-day  | string    | The day you're on the challenge, e.g. 1-100      | false                |
| position  | string    | Where to put the ribbon either `left` or `right` | true                 |
| href      | string    | The URL that points to your repo or whatever     | false                |

| Observed Attribute can be modified from JavaScript.

## Customization

```html
<hdoc-ribbon
  data-day="11"
  position="right"
  href="https://github.com/attomos/100-days-of-code"
></hdoc-ribbon>
```

```js
const ribbon = document.querySelector("hdoc-ribbon");
ribbon.theme = {
  backgroundColor: "#c8e8de",
  borderHoverColor: "#4e635c",
  backgroundHoverColor: "#8ebdae",
};
```

### Customizable Properties

| Property                   | Data Type | Description                                    |
| -------------------------- | --------- | ---------------------------------------------- |
| theme.borderColor          | string    | Border color of the ribbon in normal state     |
| theme.backgroundColor      | string    | Background color of the ribbon in normal state |
| theme.borderHoverColor     | string    | Border color when the ribbon is hovered        |
| theme.backgroundHoverColor | string    | Background color when the ribbon is hovered    |

## Inspirations

I got this idea by looking at what @narze did in his day 5 and day 6 of #100DaysOfCode challenge.  
He created #100DaysOfCode CSS ribbon and published it to [npm](https://www.npmjs.com/package/hundred-days-of-code-css-ribbon).

Please check out his work from the links below.

- https://100daysofcode-narze.vercel.app/days/5/
- https://100daysofcode-narze.vercel.app/days/6/
- https://github.com/narze/100-days-of-code-ribbon

### Things I learned from @narze ribbon as well as creating my own

1. Learn about https://unpkg.com/ which is CDN to serve files from npm packages
2. Some CSS transforms to make the ribbon on the corner
3. My ribbon is a bit different from [@narze's](https://github.com/narze/100-days-of-code-ribbon). I
   create custom HTML element, while his ribbon is CSS magic (use the ribbon class and pass data to
   attr() function).

---
_Source: https://npm.io/package/hdoc-ribbon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
