Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0218d5c7

Přidáno uživatelem Adam Mištera před asi 4 roky(ů)

Issue #8050 @3h
[+] Vytvoření komponenty pro knihy na desktop
[+] Stylování komponenty a testování napojení na controller

Zobrazit rozdíly:

public/css/app.css
11704 11704
  margin-bottom: 3rem;
11705 11705
}
11706 11706

  
11707
.books-component .book-area .card-cus-bottom {
11708
  display: flex;
11709
  justify-content: space-between;
11710
  align-items: baseline;
11711
}
11712

  
11713
.books-component .book-area .card-cus-bottom .book-arrow:after {
11714
  content: "";
11715
  bottom: 3rem;
11716
  position: absolute;
11717
  border-top: 1.25rem solid transparent;
11718
  border-bottom: 1.25rem solid transparent;
11719
}
11720

  
11721
.books-component .book-area .card-cus-bottom .book-arrow-left:after {
11722
  left: 25%;
11723
  border-right: 1.25rem solid #ddd1b9;
11724
}
11725

  
11726
.books-component .book-area .card-cus-bottom .book-arrow-right:after {
11727
  right: 25%;
11728
  border-left: 1.25rem solid #ddd1b9;
11729
}
11730

  
11731
.books-component .book-area .card-cus-bottom .likes {
11732
  display: flex;
11733
  flex-direction: column;
11734
  align-items: center;
11735
}
11736

  
11737
.books-component .book-area .card-cus-bottom .likes .inter_like,
11738
.books-component .book-area .card-cus-bottom .likes .inter_like_filled {
11739
  margin: 0 auto;
11740
}
11741

  
11742
.books-component .book-area .card-cus-bottom .likes .inter_like:before,
11743
.books-component .book-area .card-cus-bottom .likes .inter_like_filled:before {
11744
  margin-right: 0;
11745
  height: 5rem;
11746
  width: 5rem;
11747
}
11748

  
11749
.books-component .book-area .card-cus-bottom .likes .artefact-likes {
11750
  font-size: 12pt;
11751
  padding: 0;
11752
}
11753

  
11754
.books-component .info-area {
11755
  color: #ddd1b9;
11756
  margin-top: 0.625rem;
11757
  padding-left: 5rem;
11758
  /* could be use to hide overflowing notes
11759
  max-height: 80vh;
11760
  overflow-y: scroll;
11761
  scrollbar-width: none;
11762
  -ms-overflow-style: none;
11763

  
11764
  &::-webkit-scrollbar {
11765
      width: 0 !important
11766
  } */
11767
}
11768

  
11769
.books-component .info-area h3 {
11770
  font-weight: 600;
11771
}
11772

  
11773
.books-component .info-area .switch-view {
11774
  float: right;
11775
  color: #ffffff;
11776
  cursor: pointer;
11777
}
11778

  
11779
.books-component .info-area .artefact-notes {
11780
  display: none;
11781
  color: #ddd1b9;
11782
}
11783

  
11784
.books-component .info-area .artefact-notes .pin-horizontal {
11785
  border-bottom: 0.042rem solid #ddd1b9;
11786
  display: inline-block;
11787
  margin: 2.75rem 2rem 0 0;
11788
}
11789

  
11790
.books-component .info-area .artefact-notes .pin-horizontal:after {
11791
  content: "";
11792
  background-color: #ddd1b9;
11793
  position: relative;
11794
  height: 0.5rem;
11795
  width: 0.5rem;
11796
  border-radius: 50%;
11797
  display: block;
11798
  margin-left: auto;
11799
  top: 0.25rem;
11800
}
11801

  
11802
.books-component .info-area .artefact-notes .pin-horizontal .metadata {
11803
  position: relative;
11804
  display: flex;
11805
  align-items: baseline;
11806
}
11807

  
11808
.books-component .info-area .artefact-notes .pin-horizontal .metadata span {
11809
  font-size: 12pt;
11810
  font-weight: 600;
11811
}
11812

  
11813
.books-component .info-area .artefact-notes .pin-horizontal .metadata .arrow-down {
11814
  position: relative;
11815
  top: 0;
11816
  right: 0;
11817
  width: 0;
11818
  height: 0;
11819
  border-left: 0.25rem solid transparent;
11820
  border-right: 0.25rem solid transparent;
11821
  border-top: 0.25rem solid #ddd1b9;
11822
  margin: 0 0.5rem 0 0.5rem;
11823
}
11824

  
11825
.books-component .info-area .artefact-notes .white-pin {
11826
  color: #ffffff;
11827
  border-bottom: 0.042rem solid #ffffff;
11828
}
11829

  
11830
.books-component .info-area .artefact-notes .white-pin:before {
11831
  content: "";
11832
  background-color: #ffffff;
11833
}
11834

  
11835
.books-component .info-area .artefact-notes .white-pin .metadata .arrow-down {
11836
  border-top: 0.25rem solid #ffffff;
11837
}
11838

  
11839
.books-component .info-area .artefact-notes .metadata-text {
11840
  font-size: 12pt;
11841
  color: #ffffff;
11842
  padding-top: 10px;
11843
  padding-left: 25px;
11844
  padding-right: 25px;
11845
}
11846

  
11847
.books-component .info-area .artefact-notes .metadata-text .inter_like:before {
11848
  background-image: url(/images/Heart_Empty.svg?974f069a126736e569df0f463d68c026);
11849
  width: 5rem;
11850
  height: 5rem;
11851
}
11852

  
11853
.books-component .info-area .artefact-notes .metadata-text .inter_like:hover,
11854
.books-component .info-area .artefact-notes .metadata-text .inter_like:focus,
11855
.books-component .info-area .artefact-notes .metadata-text .inter_like:active {
11856
  background-color: transparent !important;
11857
  border-color: transparent !important;
11858
  outline: none !important;
11859
  box-shadow: none !important;
11860
}
11861

  
11862
.books-component .info-area .artefact-notes .metadata-text .inter_like_filled:before {
11863
  background-image: url(/images/Heart_Filled.svg?e5b962dc0fd67a2042277b9826016c9c);
11864
  width: 5rem;
11865
  height: 5rem;
11866
}
11867

  
11868
.books-component .info-area .artefact-notes .metadata-text .inter_like_filled:hover,
11869
.books-component .info-area .artefact-notes .metadata-text .inter_like_filled:focus,
11870
.books-component .info-area .artefact-notes .metadata-text .inter_like_filled:active {
11871
  background-color: transparent !important;
11872
  border-color: transparent !important;
11873
  outline: none !important;
11874
  box-shadow: none !important;
11875
}
11876

  
11877
.books-component .info-area .inter_info {
11878
  float: right;
11879
  color: #ffffff;
11880
  padding-right: 1rem;
11881
}
11882

  
11883
.books-component .info-area .inter_info:before {
11884
  background-image: url(/images/Button_Info_White.svg?eeeba6da4f02d7b457f5ed048a356fc6);
11885
  width: 1.875rem;
11886
  height: 1.875rem;
11887
}
11888

  
11889
.books-component .info-area .inter_info:hover,
11890
.books-component .info-area .inter_info:focus,
11891
.books-component .info-area .inter_info:active {
11892
  background-color: transparent !important;
11893
  border-color: transparent !important;
11894
  outline: none !important;
11895
  box-shadow: none !important;
11896
}
11897

  
11707 11898
@media screen and (max-height: 450px) {
11708 11899
  .sidenav a {
11709 11900
    font-size: 18px;
......
11768 11959
    color: #272727;
11769 11960
    background-color: #ffffff;
11770 11961
  }
11962

  
11963
  .books-component .info-area {
11964
    padding-left: 1.5625rem;
11965
  }
11771 11966
}
11772 11967

  
11773 11968
@media only screen and (max-width: 540px) {
public/images/Button_Info_White.svg
1
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.17 14.17"><defs><style>.cls-1{fill:#ffffff;}.cls-2{fill:#1d1d1b;}</style></defs><title>Datový zdroj 1</title><g id="Vrstva_2" data-name="Vrstva 2"><g id="Vrstva_1-2" data-name="Vrstva 1"><circle class="cls-1" cx="7.09" cy="7.09" r="7.09"/><path class="cls-2" d="M6.47,4.1a.74.74,0,0,1,.24-.56.74.74,0,0,1,.56-.24.76.76,0,0,1,.56.24.73.73,0,0,1,.23.56.79.79,0,0,1-.79.79.73.73,0,0,1-.56-.23A.76.76,0,0,1,6.47,4.1Zm.11,1.4H8V9.93H6.58Z"/></g></g></svg>
public/js/app.js
37057 37057

  
37058 37058
$(document).ready(function () {
37059 37059
  var display_width = $(window).width();
37060
  $(".metadata").each(function () {
37061
    var metadata = $(this);
37062
    var width = metadata.width();
37063
    metadata.css("margin-left", display_width / 2 - width);
37064
  });
37060

  
37061
  if (display_width < 720) {
37062
    $(".metadata").each(function () {
37063
      var metadata = $(this);
37064
      var width = metadata.width();
37065
      metadata.css("margin-left", display_width / 2 - width);
37066
    });
37067
  }
37065 37068
});
37066 37069

  
37067 37070
/***/ }),
resources/images/interface/Button_Info_White.svg
1
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.17 14.17"><defs><style>.cls-1{fill:#ffffff;}.cls-2{fill:#1d1d1b;}</style></defs><title>Datový zdroj 1</title><g id="Vrstva_2" data-name="Vrstva 2"><g id="Vrstva_1-2" data-name="Vrstva 1"><circle class="cls-1" cx="7.09" cy="7.09" r="7.09"/><path class="cls-2" d="M6.47,4.1a.74.74,0,0,1,.24-.56.74.74,0,0,1,.56-.24.76.76,0,0,1,.56.24.73.73,0,0,1,.23.56.79.79,0,0,1-.79.79.73.73,0,0,1-.56-.23A.76.76,0,0,1,6.47,4.1Zm.11,1.4H8V9.93H6.58Z"/></g></g></svg>
resources/js/app.js
4 4
$(document).ready(function () {
5 5
    let display_width = $(window).width();
6 6

  
7
    $(".metadata").each(function() {
8
        let metadata = $(this);
9
        let width = metadata.width();
10

  
11
        metadata.css("margin-left", (display_width / 2)  - width);
12
    });
7
    if (display_width < 720)
8
    {
9
        $(".metadata").each(function() {
10
            let metadata = $(this);
11
            let width = metadata.width();
13 12

  
13
            metadata.css("margin-left", (display_width / 2)  - width);
14
        });
15
    }
14 16
});
resources/sass/_custom.scss
853 853
    margin-bottom: 3rem;
854 854
}
855 855

  
856
// books component
857
.books-component {
858

  
859
    .book-area {
860
        .card-cus-bottom {
861

  
862
            display: flex;
863
            justify-content: space-between;
864
            align-items: baseline;
865

  
866
            .book-arrow {
867
                &:after {
868
                    content: '';
869
                    bottom: 3rem;
870
                    position: absolute;
871
                    border-top: 1.25rem solid transparent;
872
                    border-bottom: 1.25rem solid transparent;
873
                }
874
            }
875

  
876
            .book-arrow-left {
877
                &:after {
878
                    left: 25%;
879
                    border-right: 1.25rem solid $theme-color-two;
880
                }
881
            }
882

  
883
            .book-arrow-right {
884
               &:after {
885
                   right: 25%;
886
                   border-left: 1.25rem solid $theme-color-two;
887
               }
888
            }
889

  
890
            .likes {
891
                display: flex;
892
                flex-direction: column;
893
                align-items: center;
894

  
895
                .inter_like, .inter_like_filled {
896
                    margin: 0 auto;
897
                    &:before {
898
                        margin-right: 0;
899
                        height: 5rem;
900
                        width: 5rem;
901
                    }
902
                }
903

  
904
                .artefact-likes {
905
                    font-size: 12pt;
906
                    padding: 0;
907
                }
908
            }
909
        }
910
    }
911

  
912
    .info-area {
913
        color: $theme-color-two;
914
        margin-top: 0.625rem;
915
        padding-left: 5rem;
916

  
917
        /* could be use to hide overflowing notes
918
        max-height: 80vh;
919
        overflow-y: scroll;
920
        scrollbar-width: none;
921
        -ms-overflow-style: none;
922

  
923
        &::-webkit-scrollbar {
924
            width: 0 !important
925
        } */
926

  
927
        h3 {
928
            font-weight: $font-weight-two;
929
        }
930

  
931
        .switch-view {
932
            float: right;
933
            color: $theme-color-one;
934
            cursor: pointer;
935
        }
936

  
937
        .artefact-notes {
938
            display: none;
939
            color: $theme-color-two;
940

  
941
            .pin-horizontal {
942
                border-bottom: .042rem solid $theme-color-two;
943
                display: inline-block;
944
                margin: 2.75rem 2rem 0 0;
945

  
946
                &:after {
947
                    content: '';
948
                    background-color: #ddd1b9;
949
                    position: relative;
950
                    height: .5rem;
951
                    width: .5rem;
952
                    border-radius: 50%;
953
                    display: block;
954
                    margin-left: auto;
955
                    top: .25rem;
956
                }
957

  
958
                .metadata {
959
                    position: relative;
960
                    display: flex;
961
                    align-items: baseline;
962

  
963
                    span {
964
                        font-size: 12pt;
965
                        font-weight: $font-weight-two;
966
                    }
967

  
968
                    .arrow-down {
969
                        position: relative;
970
                        top: 0;
971
                        right: 0;
972
                        width: 0;
973
                        height: 0;
974
                        border-left: 0.25rem solid transparent;
975
                        border-right: 0.25rem solid transparent;
976
                        border-top: 0.25rem solid $theme-color-two;
977
                        margin: 0 0.5rem 0 0.5rem;
978
                    }
979
                }
980
            }
981

  
982
            .white-pin {
983
                color: $theme-color-one;
984
                border-bottom: .042rem solid $theme-color-one;
985

  
986
                &:before {
987
                    content: '';
988
                    background-color: $theme-color-one;
989
                }
990

  
991
                .metadata {
992
                    .arrow-down {
993
                        border-top: 0.25rem solid $theme-color-one;
994
                    }
995
                }
996
            }
997

  
998
            .metadata-text {
999
                font-size: 12pt;
1000
                color: $theme-color-one;
1001
                padding-top: 10px;
1002
                padding-left: 25px;
1003
                padding-right: 25px;
1004

  
1005
                .inter_like {
1006

  
1007
                    &:before {
1008
                        background-image: url(../images/interface/Heart_Empty.svg);
1009
                        width: 5rem;
1010
                        height: 5rem;
1011
                    }
1012

  
1013
                    &:hover, &:focus, &:active {
1014
                        background-color: transparent !important;
1015
                        border-color: transparent !important;
1016
                        outline: none !important;
1017
                        box-shadow: none !important;
1018
                    }
1019
                }
1020

  
1021
                .inter_like_filled {
1022

  
1023
                    &:before {
1024
                        background-image: url(../images/interface/Heart_Filled.svg);
1025
                        width: 5rem;
1026
                        height: 5rem;
1027
                    }
1028

  
1029
                    &:hover, &:focus, &:active {
1030
                        background-color: transparent !important;
1031
                        border-color: transparent !important;
1032
                        outline: none !important;
1033
                        box-shadow: none !important;
1034
                    }
1035
                }
1036
            }
1037
        }
1038

  
1039
        .inter_info {
1040

  
1041
            float: right;
1042
            color: $theme-color-one;
1043
            padding-right: 1rem;
1044

  
1045
            &:before {
1046
                background-image: url(../images/interface/Button_Info_White.svg);
1047
                width: 1.875rem;
1048
                height: 1.875rem;
1049
            }
1050

  
1051
            &:hover, &:focus, &:active {
1052
                background-color: transparent !important;
1053
                border-color: transparent !important;
1054
                outline: none !important;
1055
                box-shadow: none !important;
1056
            }
1057
        }
1058
    }
1059
}
1060

  
856 1061
@media screen and (max-height: 450px) {
857 1062
    .sidenav a {
858 1063
        font-size: 18px;
......
912 1117
        color: $theme-color-five;
913 1118
        background-color: $theme-color-one;
914 1119
    }
1120
    .books-component {
1121
        .info-area{
1122
            padding-left: 1.5625rem;
1123
        }
1124
    }
915 1125
}
916 1126

  
917 1127
@media only screen and (max-width: 540px) {
resources/views/components/books.blade.php
1
@foreach($artefacts as $artefact)
2
<div class="container books-component">
3
    <div class="row mt-5">
4

  
5
        <div class="col-md-6 book-area">
6
            @if (!is_null($artefact))
7
                <div class="artefact-area">
8
                    <div class="card">
9
                        <a href="#imageModal" data-toggle="modal">
10
                            <img class="card-img-top" src="{{asset('images/artefacts/book_cover_01.jpg')}}" width="100%" height=auto alt="book_cover">
11
                        </a>
12
                        <div class="card-cus-bottom">
13
                            <a class="book-arrow book-arrow-left artefact-link previous-artefact" href="{{$artefacts->previousPageUrl()}}"></a>
14
                            <div class="likes">
15
                                @if ($artefact->favourite)
16
                                    <a href="{{  action('ArtefactController@unlike', ['id' => $artefact->id]) }}">
17
                                        <button id="like_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_like_filled"></button>
18
                                    </a>
19
                                @else
20
                                    <a href="{{  action('ArtefactController@like', ['id' => $artefact->id]) }}">
21
                                        <button id="like_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_like"></button>
22
                                    </a>
23
                                @endif
24
                                <h6 class="artefact-likes">{{$artefact->likes}}</h6>
25
                            </div>
26
                            <a class="book-arrow book-arrow-right artefact-link next-artefact" href="{{$artefacts->nextPageUrl()}}"></a>
27
                        </div>
28
                    </div>
29
                </div>
30
            @endif
31
        </div>
32

  
33
        <div class="col-md-6 info-area">
34
            <div class="artefact-info">
35
                <h3 class="switch-view"><a onclick="switchView()">notes</a></h3>
36
                <h3 class="artefact-name">{{$artefact->name}}</h3>
37
                <h4 class="artefact-author">{{$artefact->author}}</h4>
38
                <p>
39
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt, ex id blandit placerat, dolor nibh venenatis dui, nec malesuada odio sem a leo. Nunc vulputate augue neque.
40
                    Donec pulvinar sollicitudin arcu eget sagittis. Sed auctor, enim vel facilisis sodales, felis tellus rutrum quam, ac feugiat leo mauris ac purus. Nam placerat sed risus ut suscipit.
41
                    Sed rutrum arcu eget mi fermentum ultrices. Donec egestas volutpat eros, ut tincidunt dolor pulvinar vitae.
42
                </p>
43
                <p>
44
                    Curabitur sem elit, imperdiet ac laoreet vitae, rhoncus quis risus. Suspendisse varius dolor sem, at egestas massa suscipit non.
45
                    Morbi sit amet dictum metus, sit amet sollicitudin nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mattis leo convallis aliquam scelerisque.
46
                    Praesent vulputate porttitor quam at egestas. Proin eget orci ligula. Aenean malesuada, eros vitae convallis sagittis, neque leo ullamcorper ante, eu ultricies justo justo in lacus.
47
                </p>
48

  
49

  
50
            </div>
51

  
52
            <div class="artefact-notes">
53
                <button type="button" class="btn btn-primary button-image inter_info" onclick="switchView()"></button>
54
                <h3 class="artefact-name">{{$artefact->name}}</h3>
55
                <h4 class="artefact-author">{{$artefact->author}}</h4>
56
                @if(count($artefact->metadata) > 0)
57
                    @foreach($artefact->metadata as $meta)
58
                        <div  id="row_{{$meta->id}}" class="row text-page">
59
                            <div class="pin-horizontal">
60
                                <div class="metadata">
61
                                    <span>page {{$meta->page}}</span>
62
                                    <a href="#meta_{{$meta->id}}" class="arrow-down" data-toggle="collapse" data-target="#meta_{{$meta->id}}" onclick="openNote('#row_{{$meta->id}}')"></a>
63
                                </div>
64
                            </div>
65
                            <div id="meta_{{$meta->id}}" class="metadata-text collapse">
66
                                <p>
67
                                    {{$meta->noteEN}}
68
                                </p>
69
                                <div class="text-center">
70
                                    @if ($meta->favourite)
71
                                        <a href="{{  action('DetailsController@unlike', ['id' => $meta->id]) }}">
72
                                            <button id="like_butt_{{$meta->id}}" type="button" class="btn btn-primary button-image inter_like_filled"></button>
73
                                        </a>
74
                                    @else
75
                                        <a href="{{  action('DetailsController@like', ['id' => $meta->id]) }}">
76
                                            <button id="like_butt_{{$meta->id}}" type="button" class="btn btn-primary button-image inter_like"></button>
77
                                        </a>
78
                                    @endif
79
                                </div>
80
                            </div>
81
                        </div>
82

  
83
                    @endforeach
84
                @else
85
                    <h2>No favourite metadata yet!</h2>
86
                @endif
87
            </div>
88
        </div>
89
    </div>
90
</div>
91
@endforeach
92

  
93
<!-- Image modal -->
94
<div class="modal image-modal fade" id="imageModal" tabindex="-1" role="dialog">
95
    <div class="modal-dialog modal-dialog-centered" role="document">
96
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
97
            <span aria-hidden="true">&times;</span>
98
        </button>
99
        <div class="modal-content">
100
            <img class="card-img-top" src="{{asset('images/artefacts/book_cover_01.jpg')}}" width="100%" height=auto alt="book_cover">
101
        </div>
102
    </div>
103
</div>
104

  
105
<script>
106
    function switchView()
107
    {
108
        let info = $('.artefact-info');
109
        let notes = $('.artefact-notes');
110

  
111
        if (notes.css('display') === 'none')
112
        {
113
            notes.css('display', 'block');
114
            info.css('display', 'none');
115

  
116
            let parent_width = notes.width();
117

  
118
            $(".metadata").each(function() {
119
                let metadata = $(this);
120
                let width = metadata.width();
121

  
122
                metadata.css("margin-left", (parent_width / 2)  - width);
123
            });
124
        }
125
        else
126
        {
127
            notes.css('display', 'none');
128
            info.css('display', 'block');
129
        }
130
    }
131

  
132
    function openNote(element)
133
    {
134
        let metadata = $(element);
135
        let showed = metadata.find(".metadata-text").hasClass('show');
136

  
137
        if (showed === false)
138
        {
139
            metadata.find('.pin-horizontal').addClass("white-pin");
140
        }
141
        else
142
        {
143
            metadata.find('.pin-horizontal').removeClass("white-pin");
144
        }
145

  
146
    }
147
</script>

Také k dispozici: Unified diff