Skip to content

Commit

Permalink
Merge pull request #218 from appwrite/refactor-event-modal
Browse files Browse the repository at this point in the history
Refactor Event Modal
  • Loading branch information
TorstenDittmann authored Feb 8, 2023
2 parents 2f5f209 + 148478f commit cbe9055
Show file tree
Hide file tree
Showing 10 changed files with 627 additions and 352 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
overrides: [
{
files: ['*.svelte'],
processor: 'svelte3/svelte3',
rules: {
'no-redeclare': 'off'
}
}
],
settings: {
'svelte3/typescript': () => require('typescript')
},
Expand Down
28 changes: 28 additions & 0 deletions src/lib/actions/selectionStart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { Action } from 'svelte/action';

type Props = {
onChange: (selectionStart: number) => void;
};

export const selectionStart: Action<HTMLInputElement, Props> = (node, { onChange }) => {
const handler = () => {
onChange(node.selectionStart);
};
node.addEventListener('click', handler);
node.addEventListener('keydown', handler);
node.addEventListener('keyup', handler);

return {
update({ onChange }) {
const handler = () => {
onChange(node.selectionStart);
};
node.addEventListener('click', handler);
node.addEventListener('keydown', handler);
node.addEventListener('keyup', handler);
},
destroy() {
onChange(-1);
}
};
};
4 changes: 3 additions & 1 deletion src/lib/components/copy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
export let value: string;
export let event: string = null;
export let appendTo: Parameters<typeof tooltip>['1']['appendTo'] = undefined;
let content = 'Click to copy';
Expand Down Expand Up @@ -36,7 +37,8 @@
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}
use:tooltip={{
content,
hideOnClick: false
hideOnClick: false,
appendTo
}}>
<slot />
</span>
Loading

1 comment on commit cbe9055

@vercel
Copy link

@vercel vercel bot commented on cbe9055 Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.