Skip to content

Commit

Permalink
feat: add updateStyles function and style type
Browse files Browse the repository at this point in the history
  • Loading branch information
od-hunter committed Jun 24, 2024
1 parent 82d77b3 commit 0d0ec5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/stellar-wallets-kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import {
KitActions,
ModuleInterface,
WalletNetwork,
StylesConfig,
} from './types';

export interface StellarWalletsKitParams {
selectedWalletId: string;
network: WalletNetwork;
modules: ModuleInterface[];
styles?: StylesConfig;
}

export class StellarWalletsKit implements KitActions {
Expand All @@ -21,11 +23,22 @@ export class StellarWalletsKit implements KitActions {
private network!: WalletNetwork;
private modalElement?: StellarWalletsModal;
private readonly modules: ModuleInterface[];
private styles?: StylesConfig;

constructor(params: StellarWalletsKitParams) {
this.modules = params.modules;
this.setWallet(params.selectedWalletId);
this.setNetwork(params.network);
this.styles = params.styles || {
primaryColor: '',
secondaryColor: '',
backgroundColor: '',
textColor: '',
};
}

updateStyles(styles: StylesConfig) {
this.styles = {...this.styles,...styles };
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,10 @@ export interface ModuleInterface extends KitActions {
*/
isAvailable(): Promise<boolean>;
}

export interface StylesConfig {
primaryColor: string;
secondaryColor: string;
backgroundColor: string;
textColor: string;
}

0 comments on commit 0d0ec5d

Please sign in to comment.