background
Design a modal popover, talk about how you would design it.
The question comes from a telephone interview in a large factory. This topic has an open nature, can examine the interviewer’s project planning experience and ability, is a relatively good topic.
I will try to organize my solution and discuss it with you here.
Scenario analysis
When you hear this open-ended question, you can’t just start thinking about it. It’s best to ask the interviewer further.
- What is the scope of popover? The mobile terminal
- What projects and businesses are popovers for? The company uses it uniformly
Let’s sort out the scene information.
-
Mobile terminal, the need to consider volume, keyboard pop-up, mobile compatibility, gestures, adaptive size and other issues.
-
Unified use, indicating that to carry out adequate testing, support style such as color font configuration.
configuration
Based on previous work experience, a module popover may need this configuration
-
Types of popups: only confirm popups, cancel popups, input popups, no button popups
-
Text: title, button, content of text, font size, color, position
-
Mask layer: whether to display, click whether to close the popover.
-
Behavior: can drag, resize, close button
-
Height: Fixed size or adaptive to content
-
Size: A height or width of a fixed size or a specified proportion
-
Position: center or specific top and left margins
behavior
A module popover might behave like this
-
Click the OK button to throw the confirmed event
-
Click the Cancel button to throw the canceled event
-
Click the Close button to throw the closed event (can be merged with the second point)
-
Click on the mask layer to throw the event
-
Drag the popover to change its position
-
Hold and drag the corner of the popover to change its size
plan
- Use Flex or absolute positioning to control position and size
- Introduce the concept of skins to allow a class to control properties such as color font size
- Use singleton mode to avoid enabling repeated pop-ups
At the end
I feel my writing is not perfect, I hope I can discuss with you about it.
More front end test questions, can take a look at my previous article big factory front end interview test what