mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-02 15:44:25 +02:00
feat: add button code (no style)
This commit is contained in:
parent
8902901acf
commit
1f17cfa35d
@ -37,5 +37,8 @@
|
|||||||
"esbuild",
|
"esbuild",
|
||||||
"svelte-preprocess"
|
"svelte-preprocess"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"svelte-material-icons": "^3.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
@ -7,6 +7,10 @@ settings:
|
|||||||
importers:
|
importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
|
dependencies:
|
||||||
|
svelte-material-icons:
|
||||||
|
specifier: ^3.0.5
|
||||||
|
version: 3.0.5(svelte@5.25.3)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@eslint/compat':
|
'@eslint/compat':
|
||||||
specifier: ^1.2.5
|
specifier: ^1.2.5
|
||||||
@ -1119,6 +1123,11 @@ packages:
|
|||||||
svelte:
|
svelte:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
svelte-material-icons@3.0.5:
|
||||||
|
resolution: {integrity: sha512-UbhAa+Btd5y6e6DMljVccP+cbJ8lvesltMippiCOvfIUtYe2TsQqM+P6osfrVsZHV47b1tY6AmqCuSpMKnwMOQ==}
|
||||||
|
peerDependencies:
|
||||||
|
svelte: ^3.0.0 || ^4.0.0
|
||||||
|
|
||||||
svelte@5.25.3:
|
svelte@5.25.3:
|
||||||
resolution: {integrity: sha512-J9rcZ/xVJonAoESqVGHHZhrNdVbrCfkdB41BP6eiwHMoFShD9it3yZXApVYMHdGfCshBsZCKsajwJeBbS/M1zg==}
|
resolution: {integrity: sha512-J9rcZ/xVJonAoESqVGHHZhrNdVbrCfkdB41BP6eiwHMoFShD9it3yZXApVYMHdGfCshBsZCKsajwJeBbS/M1zg==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@ -2180,6 +2189,10 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
svelte: 5.25.3
|
svelte: 5.25.3
|
||||||
|
|
||||||
|
svelte-material-icons@3.0.5(svelte@5.25.3):
|
||||||
|
dependencies:
|
||||||
|
svelte: 5.25.3
|
||||||
|
|
||||||
svelte@5.25.3:
|
svelte@5.25.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Component, Snippet } from 'svelte';
|
||||||
|
import type { SpecialTargetValues } from '$types';
|
||||||
|
|
||||||
|
type ButtonType = 'filled' | 'tonal' | 'text' | 'outlined';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
type: ButtonType;
|
||||||
|
icon?: Component;
|
||||||
|
iconSize?: number;
|
||||||
|
iconColor?: string;
|
||||||
|
href?: string;
|
||||||
|
target?: `${SpecialTargetValues}` | SpecialTargetValues;
|
||||||
|
label?: string;
|
||||||
|
children?: Snippet;
|
||||||
|
onclick?: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
let {
|
||||||
|
type,
|
||||||
|
// https://svelte.dev/docs/svelte/compiler-warnings#svelte_component_deprecated
|
||||||
|
icon: Icon,
|
||||||
|
href,
|
||||||
|
children,
|
||||||
|
label = '',
|
||||||
|
onclick = () => {},
|
||||||
|
iconSize = 20,
|
||||||
|
iconColor = 'currentColor',
|
||||||
|
target = '_self'
|
||||||
|
}: Props = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if href}
|
||||||
|
<a {href} {target} class:type aria-label={label}>
|
||||||
|
{#if Icon}
|
||||||
|
<Icon size={iconSize} color={iconColor} />
|
||||||
|
{/if}
|
||||||
|
{@render children?.()}
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
|
<button {onclick} class:type aria-label={label}>
|
||||||
|
{#if Icon}
|
||||||
|
<Icon size={iconSize} color={iconColor} />
|
||||||
|
{/if}
|
||||||
|
{@render children?.()}
|
||||||
|
</button>
|
||||||
|
{/if}
|
@ -1,2 +1,9 @@
|
|||||||
export type SHA256AuthHeader =
|
export type SHA256AuthHeader =
|
||||||
`Digest username="${string}", realm="${string}", nonce="${string}", uri="${string}", algorithm=${string}, response="${string}"`;
|
`Digest username="${string}", realm="${string}", nonce="${string}", uri="${string}", algorithm=${string}, response="${string}"`;
|
||||||
|
|
||||||
|
export enum SpecialTargetValues {
|
||||||
|
SELF = '_self',
|
||||||
|
BLANK = '_blank',
|
||||||
|
PARENT = '_parent',
|
||||||
|
TOP = '_top'
|
||||||
|
}
|
||||||
|
@ -9,7 +9,8 @@ const config = {
|
|||||||
alias: {
|
alias: {
|
||||||
$components: './src/lib/components',
|
$components: './src/lib/components',
|
||||||
$api: './src/lib/api',
|
$api: './src/lib/api',
|
||||||
$lib: './src/lib'
|
$lib: './src/lib',
|
||||||
|
$types: './src/lib/types.ts'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user