File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { BatteryWidget } from "./widgets/BatteryWidget";
22import { Clock , ClockSettings } from "./widgets/Clock" ;
33import { Notepad } from "./widgets/Notepad" ;
44import { Search , SearchSettings } from "./widgets/Search" ;
5- import { Shortcut } from "./widgets/Shortcut" ;
5+ import { Shortcut , ShortcutSettings } from "./widgets/Shortcut" ;
66import { ToDoList } from "./widgets/ToDoList" ;
77import { Weather } from "./widgets/Weather" ;
88
@@ -38,6 +38,10 @@ const WidgetMap = {
3838 component : Shortcut ,
3939 resizable : { x : false , y : false } ,
4040 size : { width : 1 , height : 1 } ,
41+ settings : {
42+ website : "" ,
43+ openInNewTab : false ,
44+ } satisfies ShortcutSettings ,
4145 } ,
4246
4347 todo : {
Original file line number Diff line number Diff line change 11import React , { useEffect , useState } from "react" ;
2- import Widget from "../Widget" ;
2+ import { WidgetState } from "../Widget" ;
33import { LinkIcon } from "@phosphor-icons/react" ;
44import globalStyles from "../App.css" ;
55import styles from "./Shortcut.css" ;
66
7- export function Shortcut ( { url = "" } : { url ?: string } ) {
7+ export interface ShortcutSettings {
8+ website : string ;
9+ openInNewTab : boolean ;
10+ }
11+
12+ export function Shortcut ( { settings } : WidgetState < ShortcutSettings > ) {
813 const [ loaded , setLoaded ] = useState ( false ) ;
914
1015 // useEffect(() => {
@@ -14,13 +19,14 @@ export function Shortcut({ url = "" }: { url?: string }) {
1419 return (
1520 < a
1621 className = { [ globalStyles . container , styles . shortcut ] . join ( " " ) }
17- href = { url }
18- title = { url }
22+ href = { settings . website }
23+ title = { settings . website }
24+ target = { settings . openInNewTab ? "_blank" : "_self" }
1925 >
2026 { ! loaded && < LinkIcon className = { styles . icon } weight = "bold" > </ LinkIcon > }
2127 < img
2228 className = { styles . icon }
23- src = { url + "/favicon.ico" }
29+ src = { settings . website + "/favicon.ico" }
2430 style = { {
2531 display : loaded ? "initial" : "none" ,
2632 } }
You can’t perform that action at this time.
0 commit comments