-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rudimentary text bubbles and background colors
TextBubbles can now be added to any of the existing components (Comic, Scene, Stick) though it only renders within Stick for now. Background Color (`bgColor`) can now be passed to all components (including TextBubble) and will render.
- Loading branch information
Showing
18 changed files
with
415 additions
and
372 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,41 @@ | ||
import React, {FC} from 'react'; | ||
|
||
import {chainCall, chainClickable} from '../../hooks/chainClickable'; | ||
|
||
import {Default} from './presets'; | ||
|
||
import './style.css'; | ||
import {stickCSSProps, textCSSProps} from '@/util/css'; | ||
import {TextBubbleProps} from '@/util/types'; | ||
|
||
const TextBubble: FC<TextBubbleProps> = (props = Default) => { | ||
const {font, fontSize, fontWeight, borderColor, borderRadius, color, dimensions, coord, text, onClick} = props; | ||
const {width, height, thickness} = {...Default.dimensions, ...dimensions}; | ||
|
||
const stickStyle = stickCSSProps({ | ||
width, | ||
height, | ||
thickness, | ||
color, | ||
coord, | ||
}); | ||
const textStyle = textCSSProps({ | ||
font, | ||
fontSize, | ||
fontWeight, | ||
borderColor, | ||
borderRadius, | ||
}); | ||
const bubbleStyle = { | ||
...stickStyle, | ||
...textStyle, | ||
}; | ||
|
||
return ( | ||
<div className="bubble" style={bubbleStyle} onClick={chainCall(onClick)}> | ||
<div className="text">{text ?? ''}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default chainClickable(TextBubble); |
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,2 @@ | ||
export {default} from './TextBubble'; | ||
export * as TextBubblePresets from './presets'; |
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,27 @@ | ||
import {TextBubbleProps} from '@/util/types'; | ||
|
||
const DEFAULT_SIZE = 'fit-content'; | ||
|
||
export const Default: Required<TextBubbleProps> = { | ||
children: [], | ||
type: 'text', | ||
bgColor: 'transparent', | ||
color: '#888888', | ||
coord: { | ||
x: '0', | ||
y: '0', | ||
}, | ||
dimensions: { | ||
width: DEFAULT_SIZE, | ||
height: DEFAULT_SIZE, | ||
thickness: '2px', | ||
}, | ||
id: 'text bubble', | ||
onClick: () => null, | ||
text: '', | ||
font: 'comic sans', | ||
fontSize: '2rem', | ||
fontWeight: 'normal', | ||
borderColor: 'transparent', | ||
borderRadius: '40%', | ||
}; |
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 @@ | ||
div.bubble { | ||
border-radius: var(--br); | ||
background-color: var(--bc); | ||
border: var(--t) solid var(--c, transparent); | ||
position: absolute !important; | ||
width: var(--w); | ||
height: var(--h); | ||
background-color: var(--bgc, transparent); | ||
padding: calc(var(--t, 1px) * 2); | ||
} | ||
|
||
.text { | ||
text-align: center; | ||
font-family: var(--f, Comic Sans MS, Comic Sans, cursive); | ||
font-size: var(--fs, auto); | ||
font-weight: var(--fw, normal); | ||
color: var(--c, #888); | ||
} |
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,3 +1,4 @@ | ||
export {default as Comic, ComicPresets} from './Comic'; | ||
export {default as Scene, ScenePresets} from './Scene'; | ||
export {default as Stick, StickPresets} from './Stick'; | ||
export {default as TextBubble, TextBubblePresets} from './TextBubble'; |
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,2 +1,2 @@ | ||
export * from './components'; | ||
export * from './util/types'; | ||
export * from './util/types'; |
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