Skip to content

Instantly share code, notes, and snippets.

View davidtranjs's full-sized avatar

David Tran davidtranjs

View GitHub Profile
@davidtranjs
davidtranjs / nextjsUpdateQueryHook.ts
Last active February 21, 2024 04:35
React hook for Nextjs to update URL query without touching other existing queries
const useQuery = () => {
const router = useRouter();
const updateQuery = ({
query,
shallow,
scroll,
}: {
query: Record<string, string | number>;
shallow?: boolean;
@davidtranjs
davidtranjs / mixin-media-query.scss
Last active February 2, 2024 07:36
SCSS mixin for media query responsive
$screen-xs-max: 599px;
$screen-sm-min: 600px;
$screen-md-min: 960px;
$screen-lg-min: 1280px;
$screen-xl-min: 1920px;
@mixin xs {
@media screen and (max-width: #{$screen-xs-max}) {
@content;
}
@davidtranjs
davidtranjs / util.scss
Created April 27, 2023 07:18
Scss mixins for stroke and shadow text effect
@function text-stroke(
$size: 2,
$color: #fff,
$size2: 10,
$color2: red,
$correction: 0
) {
$radius: $size - $correction;
$stroke: ();