-
Notifications
You must be signed in to change notification settings - Fork 6
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
13 changed files
with
401 additions
and
61 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
2 changes: 1 addition & 1 deletion
2
lib/eden-design/packages/eden-ui/components/Menu/src/EdenMenuItem.vue
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div>MenuItem</div> | ||
<div class="eden-ui__menu__menuitem">MenuItem</div> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> |
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,5 @@ | ||
import Text from "./src/EdenText.vue"; | ||
|
||
Text.__name = "text"; | ||
|
||
export { Text }; |
81 changes: 81 additions & 0 deletions
81
lib/eden-design/packages/eden-ui/components/Text/src/EdenText.vue
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,81 @@ | ||
<script setup lang="ts"> | ||
import { TextProps } from "../types/Text"; | ||
import { textSizeMap } from "../style/textProps"; | ||
import { computed } from "vue"; | ||
const props = withDefaults(defineProps<TextProps>(), { | ||
size: "body-2", | ||
level: 5, | ||
role: "text", | ||
}); | ||
const textStyle = computed(() => { | ||
const sizeProps = textSizeMap | ||
.filter(item => item.textSize === props.size) | ||
.pop(); | ||
return { | ||
fontSize: sizeProps?.fontSize, | ||
lineHeight: sizeProps?.lineHeight, | ||
color: | ||
props.color && "string" === typeof props.color | ||
? props.color | ||
: `var(--color-text-${props.level}, #242424)`, | ||
}; | ||
}); | ||
function getGradientDegree(degree: number | string | undefined) { | ||
switch (typeof degree) { | ||
case "number": | ||
return `${degree}deg`; | ||
case "string": | ||
return degree; | ||
default: | ||
return "0deg"; | ||
} | ||
} | ||
const gradientStyle = computed(() => { | ||
if ("object" === typeof props.color) { | ||
return { | ||
backgroundImage: `linear-gradient(${getGradientDegree(props.color.deg)},${ | ||
props.color.from | ||
}, ${props.color.to})`, | ||
WebkitBackgroundClip: "text", | ||
WebkitTextFillColor: "transparent", | ||
}; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<p | ||
:class="[ | ||
'eden-ui__text', | ||
{ | ||
'is-title': props.role === 'title' || props.size.startsWith('display'), | ||
'no-select': props.noSelect, | ||
disabled: props.disabled, | ||
}, | ||
]" | ||
:style="[textStyle, gradientStyle]" | ||
> | ||
<slot></slot> | ||
</p> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.eden-ui__text { | ||
&.is-title { | ||
font-family: var(--eden-title-font); | ||
font-weight: var(--eden-title-font-weight); | ||
} | ||
&.no-select { | ||
user-select: none; | ||
} | ||
&.disabled { | ||
cursor: not-allowed; | ||
color: var(--color-text-2); | ||
} | ||
} | ||
</style> |
47 changes: 47 additions & 0 deletions
47
lib/eden-design/packages/eden-ui/components/Text/style/textProps.ts
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,47 @@ | ||
export const textSizeMap = [ | ||
{ | ||
textSize: "body-3", | ||
fontSize: "14px", | ||
lineHeight: "22px", | ||
}, | ||
{ | ||
textSize: "body-2", | ||
fontSize: "16px", | ||
lineHeight: "24px", | ||
}, | ||
{ | ||
textSize: "body-1", | ||
fontSize: "18px", | ||
lineHeight: "26px", | ||
}, | ||
{ | ||
textSize: "title-3", | ||
fontSize: "20px", | ||
lineHeight: "28px", | ||
}, | ||
{ | ||
textSize: "title-2", | ||
fontSize: "24px", | ||
lineHeight: "32px", | ||
}, | ||
{ | ||
textSize: "title-1", | ||
fontSize: "28px", | ||
lineHeight: "36px", | ||
}, | ||
{ | ||
textSize: "display-3", | ||
fontSize: "32px", | ||
lineHeight: "40px", | ||
}, | ||
{ | ||
textSize: "display-2", | ||
fontSize: "48px", | ||
lineHeight: "56px", | ||
}, | ||
{ | ||
textSize: "display-1", | ||
fontSize: "64px", | ||
lineHeight: "76px", | ||
}, | ||
]; |
23 changes: 23 additions & 0 deletions
23
lib/eden-design/packages/eden-ui/components/Text/types/Text.ts
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,23 @@ | ||
export type TextProps = { | ||
size?: | ||
| "body-3" | ||
| "body-2" | ||
| "body-1" | ||
| "title-3" | ||
| "title-2" | ||
| "title-1" | ||
| "display-3" | ||
| "display-2" | ||
| "display-1"; | ||
role?: "text" | "title"; | ||
level?: 5 | 4 | 3 | 2 | 1 | "5" | "4" | "3" | "2" | "1"; | ||
noSelect?: boolean; | ||
disabled?: boolean; | ||
color?: | ||
| string | ||
| { | ||
from: string; | ||
to: string; | ||
deg?: number | string; | ||
}; | ||
}; |
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.