-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
150 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import cover1 from './1.jpg' | ||
import cover2 from './2.jpg' | ||
import cover3 from './3.jpg' | ||
import cover4 from './4.jpg' | ||
import cover5 from './5.jpg' | ||
import cover6 from './6.jpg' | ||
import cover7 from './7.jpg' | ||
|
||
const coverUrls = [cover1, cover2, cover3, cover4, cover5, cover6, cover7] | ||
|
||
/** Get the cover image URL for given user */ | ||
export function getCoverImgUrl(username: string) { | ||
// Simple hash function from username to index in `coverUrls`. | ||
// We need to ensure that the result is stable for the same user. | ||
// In the future we may allow users to customize their cover image. | ||
const idx = (username.charCodeAt(0) + username.charCodeAt(username.length - 1)) % coverUrls.length | ||
return coverUrls[idx] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { onUnmounted, ref } from 'vue' | ||
|
||
export type ReponsiveSize = 'mobile' | 'tablet' | 'desktop' | 'desktop-large' | ||
|
||
function getQuery(size: ReponsiveSize) { | ||
let query: string | ||
switch (size) { | ||
// Note: remember to keep these values in sync with the breakpoints in ./responsive.scss | ||
case 'mobile': | ||
query = '(max-width: 767px)' | ||
break | ||
case 'tablet': | ||
query = '(min-width: 768px) and (max-width: 1279px)' | ||
break | ||
case 'desktop': | ||
query = '(min-width: 1280px) and (max-width: 1679px)' | ||
break | ||
case 'desktop-large': | ||
query = '(min-width: 1680px)' | ||
break | ||
} | ||
return query | ||
} | ||
|
||
export function useResponsive(size: ReponsiveSize) { | ||
const query = getQuery(size) | ||
const mqList = window.matchMedia(query) | ||
const isMatched = ref(mqList.matches) | ||
function onMQListChange(event: MediaQueryListEvent) { | ||
isMatched.value = event.matches | ||
} | ||
|
||
mqList.addEventListener('change', onMQListChange) | ||
onUnmounted(() => mqList.removeEventListener('change', onMQListChange)) | ||
return isMatched | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.