Skip to content

Commit

Permalink
fix: link props and comment ci for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Drevoed committed Oct 6, 2022
1 parent 9caa2f9 commit b644204
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 46 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/size-compare.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: SizeCompare CI


on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
size-compare:
runs-on: ubuntu-22.04

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: Install deps
run: pnpm install

- name: Build
run: pnpm build
- name: 🚛 Size compare
uses: effector/size-compare@v1.0.0
with:
gist_id: "6eb87784dc1804c28cb490c43a5d95e0"
gist_token: "${{ secrets.SIZE_COMPARE_TOKEN }}"
github_token: "${{ secrets.GITHUB_TOKEN }}"
files: |
dist/**/*.js
#name: SizeCompare CI
#
#
#on:
# push:
# branches:
# - main
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
# workflow_dispatch:
#
#jobs:
# size-compare:
# runs-on: ubuntu-22.04
#
# steps:
# - name: Checkout repo
# uses: actions/checkout@v3
#
# - name: Setup pnpm
# uses: pnpm/action-setup@v2
#
# - name: Use Node ${{ matrix.node }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node }}
# cache: 'pnpm'
#
# - name: Install deps
# run: pnpm install
#
# - name: Build
# run: pnpm build
#
# - name: 🚛 Size compare
# uses: effector/size-compare@v1.0.0
# with:
# gist_id: "ee428e541efb123240eecef9ce1aa970"
# gist_token: "${{ secrets.SIZE_COMPARE_TOKEN }}"
# github_token: "${{ secrets.GITHUB_TOKEN }}"
# files: |
# dist/**/*.js
26 changes: 22 additions & 4 deletions src/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export function Link<Params extends RouteParams>(props: Props<Params>) {

const toIsString = createMemo(() => typeof props.to === 'string');

const [_, normal] = splitProps(props, [
const [routeProps, normalProps] = splitProps(props, [
'to',
'params',
'query',
'class',
'activeClass',
'inactiveClass',
'href',
Expand All @@ -35,17 +36,27 @@ export function Link<Params extends RouteParams>(props: Props<Params>) {
return (
<Show
when={toIsString()}
fallback={<RouteLink {...props} to={props.to as RouteInstance<Params>} />}
fallback={
<RouteLink
{...routeProps}
{...props}
to={props.to as RouteInstance<Params>}
/>
}
keyed={false}>
<NormalLink href={props.to as string} {...normal} />
<NormalLink
href={props.to as string}
class={props.class}
{...normalProps}
/>
</Show>
);
}

function NormalLink(
props: { class?: string } & JSX.AnchorHTMLAttributes<HTMLAnchorElement>
) {
return <a class={props.class} {...props} />;
return <a class={cc(props.class)} {...props} />;
}

function RouteLink<Params extends RouteParams>(
Expand All @@ -58,6 +69,13 @@ function RouteLink<Params extends RouteParams>(
inactiveClass?: string;
} & JSX.AnchorHTMLAttributes<HTMLAnchorElement>
) {
props = mergeProps(
{
activeClass: 'active',
},
props
);

const [split, rest] = splitProps(props, [
'to',
'params',
Expand Down

0 comments on commit b644204

Please sign in to comment.