简体   繁体   中英

How to show half transparent div in react?

I'm currently working in a react project. There is item details page is displayed when clicking on any item on mail page (same as product and product detail page).

In that detail page i want hide the part of form when user is not authenticated and show a login button.

Recently i came across, medium pair articles will hide the content if member is not belong to subscription plan.

在此处输入图片说明

The same i want implement in my project. i can hide content based isAUTH.

function pageDetail({ auth }){
  return (
      <Actual content >
      { auth && 
       <Form />
      }
      <Login-ui >
   )
}

Here i need to hide from 50 % from bottom and show the login ui with opacity on top (same as image above).

Any suggestions would greatly appreciated. Thanks

you can create a login component with the same height of the visible page, and putting in that component a linear gradient background:

background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 100%); 

you should then block the scrolling for the article behind it, in order to not show the full text to users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM