Amazon VO 面试真题解析:Like Button States 按钮状态设计题

18次阅读
没有评论

Like Button States

A button can appear in three different states: normal, hovered, and clicked.

In the normal state, the button is outlined with a neutral color and shows a heart icon followed by the text Like.

In the hovered state, the outline and icon/text change to a highlighted color.

In the clicked state, the button is filled with the highlighted color and the icon/text become white.

Design or implement the button states so that the visual appearance changes correctly according to user interaction.

这道题考察的是按钮交互状态设计,核心是根据用户的鼠标悬停和点击行为切换不同的 UI 样式。通常需要把按钮拆成多个状态来管理:默认态显示灰色描边和图标,hover 态切换为高亮描边与文字颜色,clicked 态则变为实心高亮背景并将内容改为白色。实现时重点在于状态机式的样式切换、类名控制或前端组件状态管理,而不是复杂算法。

正文完
 0