Skip to content

Commit

Permalink
Merge pull request #4 from diecodev/perf-resumability
Browse files Browse the repository at this point in the history
Perf resumability
  • Loading branch information
diecodev authored Jan 29, 2024
2 parents f9d280d + 3a44700 commit ece2b38
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 164 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ node_modules
# Cache
.cache
.mf
.vscode
.rollup.cache
tsconfig.tsbuildinfo

Expand Down
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"seatonjiang.gitmoji-vscode",
"vivaxy.vscode-conventional-commits",
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"conventionalCommits.emojiFormat": "emoji",
}
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing to Qwik-Sonner

Thank you for considering contributing to Qwik-Sonner! This library provides toast notifications for seamless user feedback.

To contribute, please follow these guidelines:

## Getting Started

1. Fork the Qwik-Sonner repository on GitHub.
2. Clone the forked repository to your local machine.

```bash
git clone https://github.com/your-username/qwik-sonner.git
```

3. Create a new branch to work on. The branch name should briefly describe the changes you're making.

```bash
git checkout -b feature/your-change
```

## Making Changes

- If you are making general changes, describe them in the branch name.
- If you are working on the website, add "website" after the verb in the branch name.

Example:
- `feature/update-readme`
- `feature-website/add-new-feature`

### Commit Messages

For commit messages, use [Conventional Commits](https://www.conventionalcommits.org/) format. If you're making changes to the website, include the "website" scope.

### Visual Studio Code Setup

For an optimal development experience, use the extensions provided in the `.vscode` folder. Additionally, execute the Conventional Commits extension to follow the commit message conventions.

## Creating a Pull Request

1. Push your changes to your forked repository.

```bash
git push origin feature/your-change
```

2. Create a Pull Request (PR) on the original Qwik-Sonner repository.

Make sure to include:

- A descriptive title for your PR.
- Details about the changes made.
- Any relevant context or motivation.
- Mention if a package version update is needed and explain the reasons.

## Versioning

If your changes require a package version update, clearly state it in the PR. Provide reasons and justifications for the version update.

Thank you for your contribution! 🚀
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwik-sonner",
"version": "0.1.0",
"version": "0.2.0",
"description": "An opinionated toast component for Qwik.",
"keywords": [
"qwik",
Expand Down
13 changes: 3 additions & 10 deletions src/components/toast-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ import {
useVisibleTask$,
} from "@builder.io/qwik";
import { ToastProps } from "../utils/types";
import {
GAP,
SWIPE_THRESHOLD,
TIME_BEFORE_UNMOUNT,
TOAST_LIFETIME,
} from "../constants";
import { SWIPE_THRESHOLD, TIME_BEFORE_UNMOUNT } from "../constants";
import { Loader, getAsset } from "./assets";

type ToastCardState = {
Expand Down Expand Up @@ -59,9 +54,7 @@ export const Toast = component$((props: ToastProps) => {
return partialIndex === -1 ? 0 : partialIndex;
});

const duration = useComputed$(
() => props.toast.duration || props.duration || TOAST_LIFETIME
);
const duration = useComputed$(() => props.toast.duration || props.duration);

const closeTimerStartTimeRef = useSignal<number>(0);
// const closeTimerRemainingTimeRef = useSignal<number>(duration.value);
Expand All @@ -80,7 +73,7 @@ export const Toast = component$((props: ToastProps) => {
});

const offset = useComputed$(
() => heightIndex.value * (props.gap ?? GAP) + toastsHeightBefore.value
() => heightIndex.value * props.gap + toastsHeightBefore.value
);

// eslint-disable-next-line qwik/no-use-visible-task
Expand Down
Loading

0 comments on commit ece2b38

Please sign in to comment.