-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WEB-1424] chore: page and view logo implementation, and emoji/icon p…
…icker improvement (#4583) * chore: added logo_props * chore: logo props in cycles, views and modules * chore: emoji icon picker types updated * chore: info icon added to plane ui package * chore: icon color adjust helper function added * style: icon picker ui improvement and default color options updated * chore: update page logo action added in store * chore: emoji code to unicode helper function added * chore: common logo renderer component added * chore: app header project logo updated * chore: project logo updated across platform * chore: page logo picker added * chore: control link component improvement * chore: list item improvement * chore: emoji picker component updated * chore: space app and package logo prop type updated * chore: migration * chore: logo added to project view * chore: page logo picker added in create modal and breadcrumbs * chore: view logo picker added in create modal and updated breadcrumbs * fix: build error * chore: AIO docker images for preview deployments (#4605) * fix: adding single docker base file * action added * fix action * dockerfile.base modified * action fix * dockerfile * fix: base aio dockerfile * fix: dockerfile.base * fix: dockerfile base * fix: modified folder structure * fix: action * fix: dockerfile * fix: dockerfile.base * fix: supervisor file name changed * fix: base dockerfile updated * fix dockerfile base * fix: base dockerfile * fix: docker files * fix: base dockerfile * update base image * modified docker aio base * aio base modified to debian-12-slim * fixes * finalize the dockerfiles with volume exposure * modified the aio build and dockerfile * fix: codacy suggestions implemented * fix: codacy fix * update aio build action --------- Co-authored-by: sriram veeraghanta <[email protected]> * fix: merge conflict * chore: lucide react added to planu ui package * chore: new emoji picker component added with lucid icon and code refactor * chore: logo component updated * chore: emoji picker updated for pages and views --------- Co-authored-by: NarayanBavisetti <[email protected]> Co-authored-by: Manish Gupta <[email protected]> Co-authored-by: sriram veeraghanta <[email protected]>
- Loading branch information
1 parent
ddf1cf8
commit 5381868
Showing
64 changed files
with
1,411 additions
and
301 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
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
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
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,100 @@ | ||
import { Placement } from "@popperjs/core"; | ||
import { EmojiClickData, Theme } from "emoji-picker-react"; | ||
|
||
export enum EmojiIconPickerTypes { | ||
EMOJI = "emoji", | ||
ICON = "icon", | ||
} | ||
|
||
export const TABS_LIST = [ | ||
{ | ||
key: EmojiIconPickerTypes.EMOJI, | ||
title: "Emojis", | ||
}, | ||
{ | ||
key: EmojiIconPickerTypes.ICON, | ||
title: "Icons", | ||
}, | ||
]; | ||
|
||
export type TChangeHandlerProps = | ||
| { | ||
type: EmojiIconPickerTypes.EMOJI; | ||
value: EmojiClickData; | ||
} | ||
| { | ||
type: EmojiIconPickerTypes.ICON; | ||
value: { | ||
name: string; | ||
color: string; | ||
}; | ||
}; | ||
|
||
export type TCustomEmojiPicker = { | ||
isOpen: boolean; | ||
handleToggle: (value: boolean) => void; | ||
buttonClassName?: string; | ||
className?: string; | ||
closeOnSelect?: boolean; | ||
defaultIconColor?: string; | ||
defaultOpen?: EmojiIconPickerTypes; | ||
disabled?: boolean; | ||
dropdownClassName?: string; | ||
label: React.ReactNode; | ||
onChange: (value: TChangeHandlerProps) => void; | ||
placement?: Placement; | ||
searchPlaceholder?: string; | ||
theme?: Theme; | ||
iconType?: "material" | "lucide"; | ||
}; | ||
|
||
export const DEFAULT_COLORS = ["#95999f", "#6d7b8a", "#5e6ad2", "#02b5ed", "#02b55c", "#f2be02", "#e57a00", "#f38e82"]; | ||
|
||
export type TIconsListProps = { | ||
defaultColor: string; | ||
onChange: (val: { name: string; color: string }) => void; | ||
}; | ||
|
||
/** | ||
* Adjusts the given hex color to ensure it has enough contrast. | ||
* @param {string} hex - The hex color code input by the user. | ||
* @returns {string} - The adjusted hex color code. | ||
*/ | ||
export const adjustColorForContrast = (hex: string): string => { | ||
// Ensure hex color is valid | ||
if (!/^#([0-9A-F]{3}){1,2}$/i.test(hex)) { | ||
throw new Error("Invalid hex color code"); | ||
} | ||
|
||
// Convert hex to RGB | ||
let r = 0, | ||
g = 0, | ||
b = 0; | ||
if (hex.length === 4) { | ||
r = parseInt(hex[1] + hex[1], 16); | ||
g = parseInt(hex[2] + hex[2], 16); | ||
b = parseInt(hex[3] + hex[3], 16); | ||
} else if (hex.length === 7) { | ||
r = parseInt(hex[1] + hex[2], 16); | ||
g = parseInt(hex[3] + hex[4], 16); | ||
b = parseInt(hex[5] + hex[6], 16); | ||
} | ||
|
||
// Calculate luminance | ||
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255; | ||
|
||
// If the color is too light, darken it | ||
if (luminance > 0.5) { | ||
r = Math.max(0, r - 50); | ||
g = Math.max(0, g - 50); | ||
b = Math.max(0, b - 50); | ||
} | ||
|
||
// Convert RGB back to hex | ||
const toHex = (value: number): string => { | ||
const hex = value.toString(16); | ||
return hex.length === 1 ? "0" + hex : hex; | ||
}; | ||
|
||
return `#${toHex(r)}${toHex(g)}${toHex(b)}`; | ||
}; |
Oops, something went wrong.