//
//  GMDiaryShareInfoView.m
//  Gengmei
//
//  Created by yefengming on 2018/12/20.
//  Copyright © 2018年 更美互动信息科技有限公司. All rights reserved.
//

#import "GMDiaryShareInfoView.h"
#import <GMKit/UIColor+GMTheme.h>
#import <Masonry/Masonry.h>
#import <GMKit/Constant.h>

@implementation GMDiaryShareInfoView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.diaryNameLabel = [GMLabel labelWithTextColor:RGBCOLOR_HEX(0x333333) fontSize:15];
        [self addSubview:self.diaryNameLabel];
        self.shareButton = [[GMButton alloc] init];
        [self.shareButton setImage:[UIImage imageNamed:@"share_diary"] forState:UIControlStateNormal];
        [self.shareButton setImage:[UIImage imageNamed:@"share_diary"] forState:UIControlStateHighlighted];
        [self.shareButton addTarget:self action:@selector(shareButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.shareButton];
        [self.diaryNameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(20);
            make.height.mas_equalTo(15);
            make.centerY.mas_equalTo(self.shareButton);
            make.width.mas_equalTo(MAINSCREEN_WIDTH - 99);
        }];
        [self.shareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-20);
            make.top.mas_equalTo(14);
        }];
    }
    return self;
}

- (void)shareButtonClick:(UIButton *)sender {
    if (self.shareClickedBlcok) {
        self.shareClickedBlcok();
    }
}

@end
