Просмотр исходного кода

Style the onboarding prompt as a modal; close it when clicked outside.

Paulo Reis 9 лет назад
Родитель
Сommit
594f2024d1

+ 1 - 0
services/web/app/views/project/editor/feature-onboarding.pug

@@ -3,6 +3,7 @@ div(ng-controller="FeatureOnboardingController")
 		ng-class="('feat-onboard-step' + onboarding.innerStep)"
 		ng-if="!state.loading && showCollabFeaturesOnboarding"
 		ng-cloak
+		stop-propagation="click"
 	)
 		a.feat-onboard-dismiss(
 			href

+ 6 - 4
services/web/public/coffee/ide/FeatureOnboardingController.coffee

@@ -24,11 +24,13 @@ define [
 
 		handleKeydown = (e) ->
 			switch e.keyCode
-				when 37 then $scope.gotoPrevStep()		# left directional key
-				when 39, 13 then $scope.gotoNextStep()	# right directional key, enter
-				when 27 then $scope.dismiss()			# escape
+				when 37 then $scope.gotoPrevStep()     # left directional key
+				when 39, 13 then $scope.gotoNextStep() # right directional key, enter
+				when 27 then $scope.dismiss()          # escape
 
 		$(document).on "keydown", handleKeydown
+		$(document).on "click", $scope.dismiss
 
 		$scope.$on "$destroy", () -> 
-			$(document).off "keydown", handleKeydown
+			$(document).off "keydown", handleKeydown
+			$(document).off "click", $scope.dismiss

+ 9 - 5
services/web/public/stylesheets/app/editor/feature-onboarding.less

@@ -1,9 +1,12 @@
+@feat-onboard-width: 900px;
+
 .feat-onboard {
 	position: fixed;
-	top: 0;
-	right: 0;
-	bottom: 0;
-	left: 0;
+	top: 50px;
+	bottom: 50px;
+	left: 50%;
+	width: @feat-onboard-width;
+	margin-left: -(@feat-onboard-width / 2);
 	display: flex;
  	justify-content: center;
  	align-items: baseline;
@@ -12,11 +15,12 @@
 	background-position-x: 0;
 	color: #FFF;
 	text-align: center;
+	border-radius: 1em;
 	z-index: 102;
 	overflow: auto;
 }
 	.feat-onboard-wrapper {
-		padding-top: 30px;
+		padding: 30px 0;
 	}
 
 		.feat-onboard-title {