Skip to content

Commit 00371a9

Browse files
committed
timer styles updated
1 parent ab8db5c commit 00371a9

File tree

1 file changed

+56
-11
lines changed

1 file changed

+56
-11
lines changed

client/packages/lowcoder/src/comps/comps/timerComp.tsx

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CompAction, RecordConstructorToView, changeChildAction } from "lowcoder-core";
22
import { styleControl } from "comps/controls/styleControl";
3-
import { timerStyle, timerStyleType } from "comps/controls/styleControlConstants";
3+
import { startButtonStyle, StartButtonStyleType, timerStyle, timerStyleType } from "comps/controls/styleControlConstants";
44
import { UICompBuilder } from "comps/generators/uiCompBuilder";
55
import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
66
import { Section, sectionNames } from "lowcoder-design";
@@ -24,21 +24,54 @@ const Container = styled.div<{ $style: timerStyleType | undefined }>`
2424
word-wrap: break-word;
2525
line-height: initial;
2626
background-color: ${props => props.$style?.background};
27-
border: 1px solid ${props => props.$style?.border};
28-
border-radius: ${props => props.$style?.radius};
29-
color: ${props => props.$style?.fontColor};
27+
font-weight: ${props=>props?.$style?.textWeight};
28+
border-radius: ${props=>props?.$style?.radius};
29+
font-size: ${props=>props?.$style?.textSize};
30+
rotate: ${props=>props?.$style?.rotation};
31+
text-transform: ${props=>props?.$style?.textTransform};
32+
color: ${props=>props?.$style?.text};
33+
border: ${props => props?.$style?.border};
34+
border-style: ${props=>props?.$style?.borderStyle};
35+
border-width: ${props=>props?.$style?.borderWidth};
36+
font-family: ${props=>props?.$style?.fontFamily};
37+
font-style: ${props=>props?.$style?.fontStyle};
38+
margin: ${props=>props?.$style?.margin};
39+
padding: ${props=>props?.$style?.padding};
40+
background: ${props=>props?.$style?.background};
41+
text-decoration: ${props=>props?.$style?.textDecoration};
3042
`;
3143

3244
const ButtonWarrper = styled.div`
3345
width: 100%;
3446
min-height: 35px;
3547
display: flex;
36-
justify-content: flex-end;
48+
justify-content: center;
3749
padding-right: 15px;
3850
padding-bottom: 10px;
39-
margin-top: -10px;
51+
margin-top: 10px;
4052
`;
4153

54+
const StyledButton = styled(Button)<{ $style: StartButtonStyleType }>`
55+
background-color: ${props=>props.$style.background};
56+
font-weight: ${props=>props.$style.textWeight};
57+
border-radius: ${props=>props.$style.radius};
58+
font-size: ${props=>props.$style.textSize};
59+
rotate: ${props=>props.$style.rotation};
60+
text-transform: ${props=>props.$style.textTransform};
61+
color: ${props=>props.$style.text};
62+
border: ${props => props.$style.border};
63+
border-style: ${props=>props.$style.borderStyle};
64+
border-width: ${props=>props.$style.borderWidth};
65+
font-family: ${props=>props.$style.fontFamily};
66+
font-style: ${props=>props.$style.fontStyle};
67+
margin: ${props=>props.$style.margin};
68+
padding: ${props=>props.$style.padding};
69+
background: ${props=>props.$style.background};
70+
text-decoration: ${props=>props.$style.textDecoration};
71+
`;
72+
73+
74+
4275
function formatTimeDifference(timeDifference: number) {
4376
// 计算时、分、秒、毫秒
4477
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
@@ -64,6 +97,8 @@ const timerTypeOptions = [
6497

6598
const childrenMap = {
6699
style: styleControl(timerStyle),
100+
startButtonStyle: styleControl(startButtonStyle),
101+
resetButtonStyle: styleControl(startButtonStyle),
67102
onEvent: eventHandlerControl(EventOptions),
68103
defaultValue: stringExposingStateControl("defaultValue", '00:00:00:000'),
69104
timerType: dropdownControl(timerTypeOptions, 'timer'),
@@ -162,19 +197,21 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
162197
{formatTimeDifference(elapsedTime)}
163198
<ButtonWarrper hidden={props.hideButton}>
164199
<Space>
165-
<Button
200+
<StyledButton
201+
$style={props.startButtonStyle}
166202
disabled={!buttonState}
167203
type={timerState === 'stoped' ? "primary" : 'default'}
168204
onClick={() => {
169205
if (timerState === 'stoped') startAction()
170206
else if (timerState === 'started') pauseAction()
171207
else if (timerState === 'paused') resumeAction()
172208
}}
173-
>{timerState === 'stoped' ? trans('timer.start') : (timerState === 'started' ? trans('timer.pause') : trans('timer.resume'))}</Button>
174-
<Button
175-
onClick={() => resetAction()}
209+
>{timerState === 'stoped' ? trans('timer.start') : (timerState === 'started' ? trans('timer.pause') : trans('timer.resume'))}</StyledButton>
210+
<StyledButton
211+
$style={props.resetButtonStyle}
212+
onClick={() => resetAction()}
176213
>{trans('timer.reset')}
177-
</Button>
214+
</StyledButton>
178215
</Space>
179216
</ButtonWarrper>
180217
</Container>
@@ -206,9 +243,17 @@ let AvatarGroupBasicComp = (function () {
206243
)}
207244

208245
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
246+
<>
209247
<Section name={sectionNames.style}>
210248
{children.style.getPropertyView()}
211249
</Section>
250+
<Section name={sectionNames.startButtonStyle}>
251+
{children.startButtonStyle.getPropertyView()}
252+
</Section>
253+
<Section name={sectionNames.resetButtonStyle}>
254+
{children.resetButtonStyle.getPropertyView()}
255+
</Section>
256+
</>
212257
)}
213258
</>
214259
))

0 commit comments

Comments
 (0)