forked from sleepy-zone/fabritor-web
-
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.
- Loading branch information
1 parent
ed929d7
commit 8b8079e
Showing
17 changed files
with
147 additions
and
24 deletions.
There are no files selected for viewing
Binary file added
BIN
+8.14 MB
src/assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.eot
Binary file not shown.
Binary file added
BIN
+7.03 MB
src/assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.otf
Binary file not shown.
Binary file added
BIN
+8.14 MB
src/assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.ttf
Binary file not shown.
Binary file added
BIN
+5.33 MB
src/assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff
Binary file not shown.
Binary file added
BIN
+5.01 MB
src/assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff2
Binary file not shown.
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,3 @@ | ||
import { createContext } from 'react'; | ||
|
||
export const GloablStateContext = createContext<any>(null); |
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
File renamed without changes.
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,59 @@ | ||
import { useContext, useEffect } from 'react'; | ||
import { Form, InputNumber, ColorPicker, Select } from 'antd'; | ||
import { TEXT_ALIGN_LIST, FONT_PRESET_FAMILY_LIST } from '@/utils/constants'; | ||
import { GloablStateContext } from '@/context'; | ||
|
||
const { Item: FormItem } = Form; | ||
|
||
export default function TextSetter (props) { | ||
const { object } = useContext(GloablStateContext); | ||
const [form] = Form.useForm(); | ||
|
||
const handleValuesChange = (values) => { | ||
console.log(values) | ||
} | ||
|
||
useEffect(() => { | ||
form.setFieldsValue({ | ||
fontFamily: object.fontFamily, | ||
fontSize: object.fontSize, | ||
fill: object.fill, | ||
textAlign: object.textAlign | ||
}); | ||
}, [object]); | ||
|
||
return ( | ||
<div className="fabritor-setter-form"> | ||
<Form | ||
name="fabritor-text-setter-form" | ||
form={form} | ||
onValuesChange={handleValuesChange} | ||
> | ||
<FormItem | ||
label="字体" | ||
name="fontFamily" | ||
> | ||
<Select options={FONT_PRESET_FAMILY_LIST} /> | ||
</FormItem> | ||
<FormItem | ||
label="字号" | ||
name="fontSize" | ||
> | ||
<InputNumber /> | ||
</FormItem> | ||
<FormItem | ||
label="颜色" | ||
name="fill" | ||
> | ||
<ColorPicker /> | ||
</FormItem> | ||
<FormItem | ||
label="对齐" | ||
name="textAlign" | ||
> | ||
<Select options={TEXT_ALIGN_LIST} /> | ||
</FormItem> | ||
</Form> | ||
</div> | ||
) | ||
} |
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,3 @@ | ||
.fabritor-setter-form { | ||
padding: 16px; | ||
} |
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,18 +1,29 @@ | ||
import { useContext } from 'react'; | ||
import { Layout } from 'antd'; | ||
import TextSetter from './TextSetter'; | ||
import { GloablStateContext } from '@/context'; | ||
|
||
import './index.scss'; | ||
|
||
const { Sider } = Layout; | ||
|
||
const siderStyle: React.CSSProperties = { | ||
backgroundColor: '#fff' | ||
}; | ||
|
||
export default function Setter () { | ||
export default function Setter (props) { | ||
const { object } = useContext(GloablStateContext); | ||
const objectType = object?.get?.('type') || ''; | ||
|
||
return ( | ||
<Sider | ||
style={siderStyle} | ||
width={300} | ||
> | ||
Setter | ||
{ | ||
objectType === 'textbox' ? | ||
<TextSetter object={object} /> : null | ||
} | ||
</Sider> | ||
) | ||
} |
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 @@ | ||
@font-face { | ||
font-family: "AlibabaPuHuiTi"; | ||
src: url("./assets/fonts/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff") format("woff"); | ||
font-display: swap; | ||
} |
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