Skip to content

Commit

Permalink
feat: Allow to put custom attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Florian BOUILLON <[email protected]>
  • Loading branch information
Aviortheking committed Aug 22, 2023
1 parent 9572b3b commit fbe4d7b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 82 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,47 @@
name: Build & Package

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 */6 * * *'
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 */6 * * *'
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Upgrade
id: upgrade
run: node upgrade.js
continue-on-error: true
- name: Install
run: npm i
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Build
run: npm run build
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Publish on NPM
run: npm publish
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Dzeio BOT"
git commit -a -m "bump from remote"
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GIT_TOKEN }}
branch: ${{ github.ref }}
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Upgrade
id: upgrade
run: node upgrade.js
continue-on-error: true
- name: Install
run: npm i
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Build
run: npm run build
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Publish on NPM
run: npm publish
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Dzeio BOT"
git commit -a -m "bump from remote"
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GIT_TOKEN }}
branch: ${{ github.ref }}
if: steps.upgrade.outcome == 'success' && steps.upgrade.conclusion == 'success'
35 changes: 12 additions & 23 deletions src/.Layout.astro
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
---
import type { Props as IconProps } from './index.d.ts'
export type { Props } from './index.d.ts'
export interface Props extends IconProps {}
const {
size = 24,
strokeWidth = 2,
width = size,
height = size,
stroke = 'currentColor',
strokeLinecap = 'round',
strokeLinejoin = 'round',
fill = 'none',
viewBox = '0 0 24 24'
} = (Astro.props ?? {})
const size = Astro.props.size
delete Astro.props.size
---

<svg
xmlns="http://www.w3.org/2000/svg"
class={Astro.props.class}
width={width}
height={height}
fill={fill}
viewBox={viewBox}
stroke={stroke}
stroke-width={strokeWidth}
stroke-linecap={strokeLinecap}
stroke-linejoin={strokeLinejoin}
stroke-width={2}
width={size ?? 24}
height={size ?? 24}
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
viewBox="0 0 24 24"
{...Astro.props}
>
<slot />
</svg>
4 changes: 1 addition & 3 deletions src/Template.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Layout from './.Layout.astro'
export type { Props } from './index.d.ts'
---

<Layout
{...Astro.props}
>
<Layout {...Astro.props}>
<!-- icon -->
</Layout>
13 changes: 4 additions & 9 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
export interface Props {
/// <reference types="astro/astro-jsx" />

export interface Props extends astroHTML.JSX.SVGAttributes {
size?: number
// https://github.com/withastro/astro/pull/8189
width?: number
height?: number
strokeWidth?: number
stroke?: string
fill?: string
class?: string
viewBox?: string
strokeLinecap?: "round" | "butt" | "square" | "inherit"
strokeLinejoin?: "round" | "inherit" | "miter" | "bevel"
}
4 changes: 2 additions & 2 deletions website/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ WORKDIR /home/node
# Add package json
ADD --chown=node:node package.json package-lock.json ./

# install dependencies from package lock
RUN npm ci
# install dependencies from package JSON (to keep being up to date with lucide-astro)
RUN npm i

# Add project files
ADD --chown=node:node . .
Expand Down
6 changes: 3 additions & 3 deletions website/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as LucideAstro from 'lucide-astro'
import { Github } from 'lucide-astro'
import { objectMap } from '@dzeio/object-util'
import { Image } from 'astro:assets'
import LucideLight from '../assets/lucide.light.svg'
import LucideDark from '../assets/lucide.dark.svg'
---
Expand All @@ -19,8 +19,8 @@ import LucideDark from '../assets/lucide.dark.svg'
<body class="bg-gray-50 dark:bg-gray-950 dark:text-white">
<div class="flex w-full justify-evenly my-8 px-4">
<p class="font-bold text-xl flex gap-2 items-center">
<img height={48} src={LucideLight.src} class="block dark:hidden" />
<img height={48} src={LucideDark.src} class="hidden dark:block" />
<Image height={48} src={LucideLight} class="dark:hidden" alt="Astro Logo" />
<Image height={48} src={LucideDark} class="hidden dark:block" alt="Astro Logo" />
<span>Lucide Icons for the Astro Framework</span>
</p>
<a target="_blank" class="flex gap-2 items-center" href="https://github.com/dzeiocom/lucide-astro">
Expand Down

0 comments on commit fbe4d7b

Please sign in to comment.